Kubernetes - Environment Variable

Kubernetes Environment Variable

Configuration for an application is usually injected as Environment variable. You can set a container’s environment variable in the deployment yaml file:

1
2
3
4
5
6
7
spec:
containers:
- env:
- name: FOO
value: bar
- name: BAZ
value: qux

You can also use set env command to set the container’s environment variable

1
kubectl set env deployment/deployment-name FOO="bar"

To unset an environment variable

1
kubectl set env deployment/deployment-name FOO-