I have a running container with a running app.
Now
kubectl exec -it <deployment> bash
This container exposes port 80, and I want to debug some code starting a new process on port 80 - how?
if I do kill <PID>
, then the exec shell terminates with:
command terminated with exit code 137
When you run your container it will run until the main process (defined on command
field of the container spec) exit. When you run the kill
command the container is marked as complete.
To debug like this you should run your application without starting the main application. You can run kubectl run myappdebug -it --image=YOUR_IMAGE bash
than you'll be able to debug it.
After you finish it, remember to remove the deployment with your debug: kubectl del deployment/myappdebug