<p>I have created 4 containers within a single namespace( All have bash ).
I want to ssh to container1 from container2. </p>

<p>I want to get some values like: the "image" used to create the container, any "Environment variables" etc.</p>

<p>How can I achieve it?</p>

<p>Thanks in advance.</p>

<p>Pritish</p>

Pritish
<p>If you really need to get necessary info to use with ssh, you could extract those info via <a href="https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#capabilities-of-the-downward-api" rel="nofollow noreferrer">Downward API</a>, and make sure that your pods are ssh-enabled as well.</p>

<p>IMHO, the intuitive way to check for deployment status is using readiness check. In that case, you could run a bash script to check for specific environment variables, if those info is not available then those pods would be not allowed to server traffic.</p>

<p>For e.g:</p>

<pre><code>readinessProbe:
  periodSeconds: 60
  exec:
    command:
    - "/bin/bash"
    - "-c"
    - if [ "$env" != "{{ .Values.environment }}" ]; then exit 1; fi
</code></pre>
