Kubernetes: Global environment variables for pods

September 30, 2020

I was trying to inject a few global environment variables to every container running, so one of the options was Pod Presets but I realize this feature was removed (check this pull request) probably in Kubernetes 1.20.x will disappear.

The alternative is to create a ConfigMap and use the envFrom to define all of the ConfigMap's data as container environment variables. The key from the ConfigMap becomes the environment variable name in the Pod.

Read more