I have a GKE Kubernetes cluster that I would like to debug.
Is it possible to start a container inside the cluster using e.g. ubuntu
image and SSH into it with full privileges, so I will be able to install software inside it with apt
and run various debugging commands?
Best Answer
First of all it's possible to deploy a
pod
with a single container consisting ofubuntu
targeting a namespace or even a node.Rather than using SSH to connect to it (which is possible using an extensive combination of either using a
LoadBalancer
or exposing aNodePort
) it's easier to use thekubectl
tool.If you're using
Cloud Shell
it's already installed or if using local laptop you have to install it using thegcloud
tool.I would suggest connecting to the container directly using the following syntax:
First command assumes the container name is
ubuntu
and in the current namespace. The second command gives the general format.Example
ubuntu
pod definition:You can add a
namespace
to it or ensure you have the right context before applying. Something like: