Much like default values.yaml
files for Helm, you can utilize ConfigMaps
in Kubernetes for much the same capability. Our developers have started to do this to make it easier when managing Deployment
objects across different environments.
Give a ConfigMap
:
apiVersion: v1
data:
allowed: '"true"'
enemies: aliens
lives: "3"
kind: ConfigMap
metadata:
name: engage
namespace: default
and a Deployment
:
spec:
containers:
- env:
- name: enemies
value: badguy
envFrom:
- configMapRef:
name: engage
Taking a look inside the container:
engage-6c8c65588b-m8pww# env | grep enemies
enemies=badguy