<p>We have an application which uses SSH to copy artifact from one node to other. While creating the Docker image (Linux Centos 8 based), I have installed the Openssh server and client, when I run the image from Docker command and exec into it, I am successfully able to run the SSH command and I also see the port 22 enabled and listening ( <code>$ lsof -i -P -n | grep LISTEN</code>).</p>

<p>But if I start a POD/Container using the same image in the Kubernetes cluster, I do not see port 22 enabled and listening inside the container. Even if I try to start the <code>sshd</code> from inside the k8s container then it gives me below error:</p>

<pre><code>Redirecting to /bin/systemctl start sshd.service Failed to get D-Bus connection: Operation not permitted.
</code></pre>

<p>Is there any way to start the K8s container with SSH enabled?</p>

Abhishek Jain
<p>There are three things to consider:</p>

<ol>
<li>Like David said in his comment: </li>
</ol>

<blockquote>
  <p>I'd redesign your system to use a communication system that's easier
  to set up, like with HTTP calls between pods.</p>
</blockquote>

<ol start="2">
<li><p>If you put a service in front of your deployment, it is not going to relay any SSH connections. So you have to point to the pods directly, which might be pretty inconvenient.</p></li>
<li><p>In case you have missed that: you need to declare port 22 in your deployment template. </p></li>
</ol>

<p>Please let me know if that helped. </p>
