Configuration#
This chapter covers how to pass configuration to your application via environment variables, ConfigMaps, and Secrets.
Environment Variables#
The chart supports multiple syntax styles for defining environment variables under the env key. Pick whichever fits your use case.
Simple Key-Value#
In the simple for we only pass Key-Value pairs which are added to the pod as is.
env:
TZ: UTC
LOG_LEVEL: info
PORT: "8080"
Helm Templating in Values#
We can also use Helm Template variables which gives us a lot of flexibility. For example, we could tell the app which namespace it runs in or pass in any other config from the values.yaml file. All values are available as {{ .Values.some.yaml.path }}, for example:
my:
custom:
value: 12
# Access with {{ .Values.my.custom.value }}
env:
APP_NAME: "{{ .Release.Name }}"
NAMESPACE: "{{ .Release.Namespace }}"
Reference a ConfigMap Key#
A Kubernetes ConfigMap can be used as source in the env block. This is helpful when sharing configs between applications. For example, the database URL created by a different resource (e.g. the Postgres provider) can be accessed via a configMap mount
env:
DATABASE_URL:
configMapKeyRef:
name: app-config # <-- configMap name
key: database-url # <-- key inside config map
apiVersion: v1
kind: ConfigMap
metadata:
name: app-config
data:
database-url: "localhost:1337/db-name"
Reference a Secret Key#
Environemnt Variables can be read from a Kubernetes Secret.
WE RECOMMEND to use OpenBao and Vault Secret Webhook instead of mounting secrets directly into a pod.
env:
API_KEY:
valueFrom:
secretKeyRef:
name: api-credentials
key: api-key
List Syntax#
If you prefer the standard YAML list format:
env:
- name: TZ
value: UTC
- name: SECRET_KEY
value: "{{ .Release.Name }}-secret"
All formats can be mixed. The chart normalizes them into the standard Kubernetes env array.
Secrets#
The chart can create a Kubernetes Secret from inline values. Every key-value pair under secret is stored as stringData:
secret:
DATABASE_PASSWORD: super-secret-password
API_TOKEN: abc123
This creates an Opaque Secret named after the release. It is automatically mounted as environment variables via envFrom — no extra configuration needed.
Warning: Values under
secretare stored in plaintext in yourvalues.yaml. For production, prefer referencing external secrets (see below).
Loading Environment from External Secrets or ConfigMaps#
Use envFrom to bulk-load all keys from existing Secrets or ConfigMaps:
envFrom:
- secretRef:
name: my-external-secret
- configMapRef:
name: my-external-config
This is useful when secrets are managed by an external secrets operator (e.g., External Secrets, Sealed Secrets).
ConfigMaps#
The chart can create ConfigMaps from inline data. A default config entry exists but is disabled:
Enable the Default ConfigMap#
configmap:
config:
enabled: true
data:
app.conf: |
server.port=8080
server.host=0.0.0.0
settings.json: |
{"debug": false, "logLevel": "info"}
Multiple ConfigMaps#
Add additional ConfigMaps by adding keys alongside config:
configmap:
config:
enabled: true
data:
application.yml: |
server:
port: 8080
nginx:
enabled: true
labels:
app.kubernetes.io/component: proxy
annotations:
description: "Nginx configuration"
data:
nginx.conf: |
server {
listen 80;
location / {
proxy_pass http://localhost:8080;
}
}
Helm Templates in ConfigMap Data#
ConfigMap data supports Helm templating:
configmap:
config:
enabled: true
data:
config.yaml: |
appName: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
replicas: {{ .Values.application.replicas }}
Automatic Rollout on ConfigMap Changes#
When any ConfigMap is enabled, the chart automatically adds a checksum/config pod annotation derived from the ConfigMap data. This ensures pods are restarted when ConfigMap content changes during a helm upgrade.
Mounting ConfigMaps as Volumes#
To mount a ConfigMap as files in the container, use persistence:
configmap:
config:
enabled: true
data:
app.conf: |
key=value
persistence:
app-config:
enabled: true
type: configMap
name: "{{ include \"names.fullname\" . }}-config"
mountPath: /etc/app
readOnly: true
{{ include \"names.fullname\" . }} is a Helm template function which ensures the configmap name is correct. The escape \" is required so the value us passed into Helm properly.
Combining It All#
A realistic example with environment variables from multiple sources:
# Inline env vars
env:
TZ: UTC
LOG_LEVEL: info
DB_HOST:
valueFrom:
secretKeyRef:
name: db-credentials
key: host
# Inline secret (auto-mounted via envFrom)
secret:
DB_PASSWORD: changeme
# Bulk-load from external sources
envFrom:
- configMapRef:
name: shared-config
# ConfigMap for file-based config
configmap:
config:
enabled: true
data:
config.yaml: |
feature_flags:
new_dashboard: true
What's Next#
Continue to Storage to attach persistent volumes to your application.