<p>I have a K8s Deployment that runs a Linux Docker image with Java and executes a sh script command running a Java process that on pod startup and it fails shortly after starting, triggering a pod crash and re-creation. It's a Java issue and logs are not helpful so I want to stop it before it fails and explore the pod file system and environemnt.</p>
<p>If I just try to <code>kill</code> the java PID the pod crashes instantly. Is there any way I can stop the Java process (without altering the program or sh script code) from inside the pod shell before it gets to the part of crashing, and not trigger a pod crash?</p>
<p>Thanks!</p>

robliv
<p>Starting from Kubernetes 1.19 you can debug running pods using <a href="https://kubernetes.io/docs/tasks/debug-application-cluster/debug-running-pod/#ephemeral-container" rel="nofollow noreferrer">Ephemeral Containers</a> and <code>kubectl debug</code> command.</p>
