Validate Secrets and ConfigMap Patterns in Helm
Check values.yaml patterns for environment variables, secrets references, ConfigMap mounts, and external secret integration.
Detailed Explanation
Secrets and ConfigMap Configuration
Helm charts commonly reference Kubernetes Secrets and ConfigMaps for configuration injection. The values.yaml file controls which secrets and configmaps are used, how they are mounted, and which environment variables are set.
Environment Variables Pattern
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: app-secrets
key: database-url
- name: LOG_LEVEL
value: "info"
- name: CONFIG_PATH
valueFrom:
configMapKeyRef:
name: app-config
key: config-path
extraEnvVars: []
Volume Mounts Pattern
extraVolumes:
- name: config-volume
configMap:
name: app-config
- name: secret-volume
secret:
secretName: app-credentials
extraVolumeMounts:
- name: config-volume
mountPath: /etc/config
readOnly: true
- name: secret-volume
mountPath: /etc/credentials
readOnly: true
What Gets Validated
- Type checks:
envandextraEnvVarsshould be arrays,extraVolumesandextraVolumeMountsshould be arrays - Structure: Environment variable entries should have
nameand eithervalueorvalueFrom - Secrets handling: Secret values should not be hardcoded in values.yaml (use external secrets or sealed secrets)
External Secrets Pattern
For production, secrets should not be stored in values files. Instead, use external secrets operators:
externalSecrets:
enabled: true
secretStoreRef:
name: aws-secrets-manager
kind: ClusterSecretStore
data:
- secretKey: database-url
remoteRef:
key: /prod/myapp/database-url
Common Anti-Patterns
- Hardcoding sensitive values directly in values.yaml
- Using plain
value:for secrets instead ofsecretKeyRef - Mounting secrets as writable volumes (should be readOnly: true)
- Not setting a
defaultModeon secret volume mounts (defaults to 0644, consider 0400)
Use Case
Reviewing a Helm chart's secret management strategy before a security audit, ensuring no credentials are hardcoded and all secret references follow the organization's external secrets pattern.
Try It — Helm Values Validator
Related Topics
Validate a Basic Web App values.yaml
Basic Configuration
Production Readiness Checklist for Helm Values
Advanced Patterns
Compare Default vs Override Values for Multi-Environment
Advanced Patterns
Validate Helm Image Configuration Patterns
Basic Configuration
Validate TLS and Certificate Configuration in Helm
Ingress & Networking