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.

Join the 80/20 DevOps Newsletter

If you're an engineering leader or developer, you should subscribe to my 80/20 DevOps Newsletter. Give me 1 minute of your day, and I'll teach you essential DevOps skills. I cover topics like Kubernetes, AWS, Infrastructure as Code, and more.

Not sure yet? Check out the archive.

Unsubscribe at any time.