<p>I am putting docker image into POD.
We can exec into a Docker container using "docker exec..."
Similarly is there a way to exec into container in a POD to check some data ?</p>

Chandu
<p>There are several ways of how to get inside the Kubernetes container in a Pod. </p>

<ul>
<li><a href="https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/" rel="nofollow noreferrer">kubectl exec</a> (<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec" rel="nofollow noreferrer">reference link</a>) creates additional process in the Pod's namespace and connects your console to it's stdin/stdout.</li>
</ul>

<p>Examples:</p>

<pre><code>kubectl exec 123456-7890 date
kubectl exec 123456-7890 -c ruby-container date
kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il
kubectl exec 123456-7890 -i -t -- ls -t /usr
</code></pre>

<ul>
<li><a href="https://kubernetes.io/docs/reference/kubectl/docker-cli-to-kubectl/" rel="nofollow noreferrer">kubectl attach</a> (<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#attach" rel="nofollow noreferrer">reference link</a>) connects your console to stdin/stdout existing container process.</li>
</ul>

<p>Example:</p>

<pre><code>kubectl attach 123456-7890
kubectl attach 123456-7890 -c ruby-container
kubectl attach 123456-7890 -c ruby-container -i -t
kubectl attach rs/nginx
</code></pre>

<p>You can also connect to stdout/stderr of pod container(s) using <a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#logs" rel="nofollow noreferrer">kubectl logs</a> command.</p>

<p>Examples:</p>

<pre><code>kubectl logs nginx
kubectl logs nginx --all-containers=true
kubectl logs -lapp=nginx --all-containers=true
kubectl logs -p -c ruby web-1
kubectl logs -f -c ruby web-1
</code></pre>

<p>These answers on StackOverflow give you more information related to your question:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/39979880/kubectl-exec-into-contain-of-multi-container-pod">kubectl exec into contain of multi container pod</a></li>
<li><a href="https://stackoverflow.com/questions/51247619/execute-bash-command-in-pod-with-kubectl/51247696">Execute bash command in pod with kubectl?</a></li>
<li><a href="https://stackoverflow.com/questions/50030252/kubectl-attach-vs-kubectl-exec">Kubectl attach vs kubectl exec?</a></li>
<li><a href="https://stackoverflow.com/questions/54874683/how-do-you-debug-python-code-with-kubernetes-and-skaffold">How do you debug python code with kubernetes and skaffold?</a></li>
</ul>
