<p>I have a deployment file and when I do <code>kubectl apply -f</code> my pods don't get deployed after a few restart and crashes. Hence my questions:</p>

<p>1- If I set the replicas to 1, is there a way to have an "interactive" mode where I can see in my terminal what's going on?</p>

<p>2- Is there a way to limit - in the deployment file - the number of restart? This can be specified for pods (restartPolicy...) but not for deployment apparently?</p>

<p>3- Any troubleshooting guidelines? For example, how to check that the values in the config maps are properly picked up?
Many thanks - Christian</p>

Christian68
<p>If your pods have managed to actually be scheduled and start, but the app inside the container crashes, then usually <code>kubectl logs</code> will be able to show you the logs that were written to stdout / stderr inside the container.</p>

<p>E.g. <code>kubectl logs -n your-namespace your-pod-name</code></p>

<p>You can also tail or head logs. E.g.</p>

<ul>
<li><code>kubectl logs -n your-namespace your-pod-name --tail=50</code> (for the last 50 log lines)</li>
<li><code>kubectl logs -n your-namespace your-pod-name -f</code> (follow logs)</li>
</ul>

<p>Otherwise if your container has failed to be scheduled by kubernetes, then describe is probably a better option.</p>

<p>E.g. <code>kubectl -n your-namespace describe your-pod-name</code></p>

<p><a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/#interacting-with-running-pods" rel="nofollow noreferrer">Here</a> are some other useful examples around interacting with pods that are running (and have not crashed yet).</p>
