<p>I want to be able to ssh into a container within an OpenShift pod.</p>

<p>I do know that, I can simply do so using <code>oc rsh</code>. But this is based on the assumption that I have the openshift cli installed on the node where I want to ssh into the container from.</p>

<p>But what I want to actually achieve is, to ssh into a container from a node that does not have openshift cli installed. The node is on the same network as that of OpenShift. The node does have access to web applications hosted on a container (just for the sake of example). But instead of web access, I would like to have ssh access.</p>

<p>Is there any way that this can be achieved?</p>

<p>Unlike a server, which is running an entire operating system on real or virtualized hardware, a container is nothing more than a single Linux process encapsulated by a few kernel features: <a href="https://en.wikipedia.org/wiki/Cgroups" rel="nofollow noreferrer">CGroups</a>, <a href="https://en.wikipedia.org/wiki/Linux_namespaces" rel="nofollow noreferrer">Namespacing</a>, and <a href="https://en.wikipedia.org/wiki/Security-Enhanced_Linux" rel="nofollow noreferrer">SELinux</a>. A "fancy" process if you will.</p>

<p>Opening a shell session into a container is not quite the same as opening an ssh connection to a server. Opening a shell into a container requires starting a shell process and assigning it to the same cgroups and namespaces on the same host as the container process and then presenting that session to you, which is not something ssh is designed for.</p>

<p>Using <a href="https://docs.openshift.com/container-platform/3.11/dev_guide/executing_remote_commands.html" rel="nofollow noreferrer">oc exec</a>, <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/" rel="nofollow noreferrer">kubectl exec</a>, <a href="https://github.com/containers/libpod/blob/master/docs/tutorials/podman_tutorial.md" rel="nofollow noreferrer">podman exec</a>, or <a href="https://docs.docker.com/engine/reference/commandline/exec/" rel="nofollow noreferrer">docker exec</a> cli commands to open a shell session inside a running container is the method that should be used to connect with running containers.</p>
