Recommended way to keep enviroment variables?

I have a kubernetes pod that loads a bunch of environment variables through a configmap and a couple of SecretRefs. When I exec into the pod I can see them when I run env.

However, when I use teleport to ssh into the pod, none of the variables are there. I suspect it has something to do with how I’m starting the teleport service. How can I add this pod to my teleport cluster and still see the original environment variables when I start an ssh session?

Inside a pod, your teleport process will likely have those env vars.
However, when logging in over an SSH session teleport builds a separate new list of env vars for the user shell. This is to avoid accidentally exposing any credentials that were present in the env vars of teleport itself.

I recommend mounting your ConfigMap as a read-only volume (https://kubernetes.io/docs/concepts/configuration/configmap/#using-configmaps-as-files-from-a-pod) and not deal with the unpredictable nature of env vars. You can do the same with secrets (https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-files-from-a-pod).