If you need to list the environment variables in a Kubernetes pod, you can do the following.

1. Get the Pod name to query

kubectl get pods

This will return something like this:

$ kubectl get pods
NAME                                  READY   STATUS    RESTARTS   AGE
kubernetes-bootcamp-fb5c67579-8tghg   1/1     Running   0          7m39s

Note the name cell for later.

2. Get the Environment variables from the Pod

Use the name from the above query to construct our new command.

kubectl exec <pod-name> -- env

So when we replace the pod-name for the one extracted above, we will have:

kubectl exec kubernetes-bootcamp-fb5c67579-8tghg -- env

This will return a list of environment variables, specific to that pod:

$ kubectl exec kubernetes-bootcamp-fb5c67579-8tghg -- env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=kubernetes-bootcamp-fb5c67579-8tghg
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
KUBERNETES_SERVICE_HOST=10.96.0.1
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP_PORT=443
NPM_CONFIG_LOGLEVEL=info
NODE_VERSION=6.3.1
HOME=/root