Don't Define The Same Env Var Multiple Times With Kubernetes

Kubernetes environment variables for CronJobs or Pods are defined as a list. You can technically define the same environment variable multiple times, and it will take the last one on the list.

However, I’ve found that this leads to strange behavior with Kubernetes tooling, and I’ve since avoided this practice.

For example, I’ve seen ArgoCD fail to generate a diff because two environment variables have the same name.


Master GitHub Actions with a Senior Infrastructure Engineer

As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.

Not sure yet? Check out the archive.

Unsubscribe at any time.