Quick way to print environment variables of a running pod
A quick post to showcase how to print environment variables of a running pod.
A quick way to print the environment variables of a running pod is to use the following command.
kubectl exec <pod-name> -- env
For example, take a look at the sample
nginx pod with few additional (
PORT) environment variables.
- image: nginx:1.14.2
- containerPort: 8080
- name: POD_NAME
- name: PORT
Once the pod is in running state, you can use the following command to print the environment variables of the pod.
kubectl exec my-pod -- env
You can see the output as below listing the environment variables.