1

I'm writing an application that dynamically deploys kubernetes resources. On each deploy, I set environment variables in the Container within the DeploymentSpec with the golang api (see https://godoc.org/k8s.io/api/core/v1#Container). Is there any reason why I'm not seeing changes in these variables on the pod?

For example, when I change my codebase to set FOO: "hi" to FOO: "hello", the variable isn't updated in the application.

Based on other answers, its probably important to note that my "checking" of the environment variables is happening at docker run time. That is, for debugging, I'm running printenv in the CMD field of the kubernetes container.

A snippet of env variables being printed before Create() on the deployment:

...

v1.EnvVar{
   Name:      "FOO",
   Value:     "foo",
},
v1.EnvVar{
   Name:      "BAR",
   Value:     "arb",
},

...

Any leads are greatly appreciated!

Jay K.
  • 546
  • 2
  • 10
  • 17
  • do other spec fields change (ie. image) ? are your pods recreated after you deploy changes ? – Radek 'Goblin' Pieczonka May 22 '20 at 06:46
  • What causes the updated deployment to actually be written out? If you `kubectl get deployment -o yaml` something you generated, does its spec match what you have? Is a failing pod preventing the deployment from proceeding? – David Maze May 22 '20 at 10:24

0 Answers0