How to Ensure Environment Variables Are Recognized by SSH in a Kubernetes Pod?

0
5
Asked By CuriousCoder98 On

I'm running a pod with the ubi9-init image, which uses systemd to manage an OpenSSH server. I've noticed that when I populate environment variables through envFrom, they're set in the /sbin/init environment, but they're not being passed to the SSH server, nor do the SSH connections seem to recognize them. I need to figure out a way for these SSH connections to have the required environment variables available. Does anyone have suggestions or approaches for achieving this?

2 Answers

Answered By ContainerNinja On

You might want to rethink your approach altogether. Having users SSH into a container to edit files can lead to a lot of problems. If you explain your goal a bit more clearly, the community could provide better guided advice.

CuriousCoder98 -

Sure! The goal is to allow users to connect to the pod via SSH and load specific configurations from a ConfigMap. I just want to make sure their sessions have the necessary environment variables.

Answered By TechWiz42 On

Honestly, running systemd in a container to manage SSH sounds like a bad idea. It might be better to separate the OpenSSH server into its own container and attach it to the terminal. This way, you can manage multiple processes in one pod without too much headache. Consider these changes to simplify your setup.

PodPal93 -

That makes sense! Keeping things simple can definitely help avoid these kinds of issues. Thanks for the advice!

SSHDrift -

Agreed! Plus, this way you can scale your SSH service more easily without stepping on the init process.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.