Most of the time the container that you are running is very slim and has tight security due to which you can’t troubleshoot the process easily.
q.g. youcant run kubectl exec to troubleshoot.
You can use
kubectl debug to create a copy f the Pod with Configuration values changed for debugging purpose
Here is how you can do that
1. Copy the pod while adding a new cotainer and share the process of the existing container in new container.
kubectl get pod my-pod -n nameSpace
so your command would be to create a copy of my-app named my-app-debug that adds a new Ubuntu container for debugging
kubectl debug my-app -it –image=ubuntu –share-process –copy-to=my-app-debug
Flags and values:
The -i flag causes kubectl debug to attach to the new container by default. You can prevent this by specifying –attach=false. If your session becomes disconnected you can reattach using kubectl attach.
The –share-processes allows the containers in this Pod to see processes from the other containers in the Pod.
kubectl debug automatically generates a container name if you don’t choose one using the –container flag.