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.
Category Archives: Kubernetes
How to login kubernetes dashboard: K8s generate token
Connect to your kubernetes cluster.
kubectl -n kube-system get secret |grep kubernetes.io/service-account-token
#All secrets with type ‘kubernetes.io/service-account-token’ will allow to log in.
# Note that they have different privileges.
kubectl -n kube-system describe secrets aws-node-token-<WHATEVERSTRING>
You will get the token from the output. Use that for login