Reusable Helm chart for deploying multiple application components with shared structure and environment-based configuration.
Supports:
- Multiple components
- Multiple instances per component (production fan-out)
- Shared global configuration
- Per-component shared config
- Per-instance overrides
- Resource inheritance and overrides
Global
↓
Component
↓
Instance
Configuration order (highest override wins):
global → component → instance
shop-platform/
├── Chart.yaml
├── templates/
│ ├── deployment.yaml
│ └── configmap.yaml
│
└── values/
├── dev.yaml
├── preprod.yaml
└── prod.yaml
helm upgrade --install shop-dev . \
-f values/dev.yamlhelm upgrade --install shop-preprod . \
-f values/preprod.yamlhelm upgrade --install shop-prod . \
-f values/prod.yamlglobal:
components:
- componentName:
image:
replicas:
resources:
commonConfig:
instances:Applies to all deployments generated by the chart.
global:
annotations:
prometheus.io/scrape: "true"
labels:
team: backend
imagePullSecrets:
- name: prod-regcred
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
nodeSelector:
workload: backend| Field | Description |
|---|---|
| annotations | Applied to all deployments/pods |
| labels | Shared labels |
| imagePullSecrets | Registry credentials |
| resources | Default resource limits/requests |
| nodeSelector | Scheduling constraints |
| tolerations | Scheduling constraints |
| affinity | Scheduling constraints |
Example: inventory
components:
- componentName: inventory
image: ghcr.io/acme/inventory-service:1.0.0
replicas: 2
commonConfig:
DB_PORT: "5432"
LOG_LEVEL: info
instances:
- name: default
config:
DB_HOST: inventory-dbExample: orders
components:
- componentName: orders
image: ghcr.io/acme/orders-service:1.3.0
replicas: 5
commonConfig:
DB_PORT: "5432"
LOG_LEVEL: warn
instances:
- name: eu
config:
DB_HOST: postgres-eu
REGION: eu
- name: us
config:
DB_HOST: postgres-us
REGION: us
- name: asia
config:
DB_HOST: postgres-asia
REGION: asiaGenerated:
orders-eu
orders-us
orders-asia
ConfigMap = merge of:
component.commonConfig
+ instance.config
Example:
commonConfig:
DB_PORT: "5432"
LOG_LEVEL: warn
instance:
config:
DB_HOST: postgres-euResult:
data:
DB_PORT: "5432"
LOG_LEVEL: "warn"
DB_HOST: "postgres-eu"Resources are resolved in this order:
global.resources → component.resources → (override)
global:
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Micomponents:
- componentName: orders
resources:
requests:
cpu: 1
memory: 1Gi
limits:
cpu: 4
memory: 4Gi- Single instance per component
- Minimal resources
- Debug logging
- Production-like setup
- Slightly reduced replicas
- Stable images (RC tags)
- Full scaling
- Multi-instance components (e.g. orders-eu/us/asia)
- Region-based configuration
gateway
orders-eu
orders-us
orders-asia
payments
notifications
- Create a new file:
values/staging.yaml
-
Copy structure from preprod or dev
-
Adjust:
- images
- replicas
- instance definitions
Run:
helm upgrade --install shop-staging . \
-f values/staging.yamlLint:
helm lint .Render:
helm template shop . -f values/prod.yamlDeploy:
helm upgrade --install shop . -f values/prod.yamlRollback:
helm rollback shop 1- Keep environment differences ONLY in
values/*.yaml - Keep shared config in
global - Keep reusable config in
component.commonConfig - Keep instance differences minimal
- Avoid duplicating images/resources across instances
- Always preview before deploy:
helm template .