SSH into Kubernetes master node from windows Machine

Viewed 305

How can we ssh into kubernetes cluster from windows machine. I am running my cluster in gcp compute engine.

1 Answers

How can we ssh into kubernetes cluster from windows machine

Hi,

SSH into Kubernetes cluster can mean:

  1. SSH into the Kubernetes pods
    If this is what you mean, you can use the command:

    kubectl -n your-namespace exec -it your-pod -- sh

If the pods contains more than one container, you can use additional parameter -c.
You can read more into the documentation here: https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec

  1. SSH into the Kubernetes nodes
    As for this, the method to get into the nodes depends on whether the Kubernetes nodes are public of private. By public, I mean that the Kubernetes nodes are exposed to the public / to the internet, so that they have each own public address. You can then use either your private key or password to SSH into the Kubernetes nodes directly from your computer.

But, if your Kubernetes nodes are private, you need to create another machine that is exposed to the public, and this new machine must be in the same VPC with the Kubernetes nodes. This machine is called bastion, and acts as a jump server, where you can SSH into, and then you can SSH into your Kubernetes nodes from this bastion or jump server.

As for how to SSH into the nodes from Windows machine, you can use either PuTTY, Cygwin, or MSYS2.
I personally prefer Git Bash for Windows that comes with Git.

References:

  1. https://www.putty.org/
  2. https://www.cygwin.com/
  3. https://www.msys2.org/
Related