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

Kevin Thomas
<blockquote>
<p>How can we ssh into kubernetes cluster from windows machine</p>
</blockquote>
<p>Hi,</p>
<p>SSH into Kubernetes cluster can mean:</p>
<ol>
<li><p>SSH into the Kubernetes pods <br>
If this is what you mean, you can use the command:</p>
<p><code>kubectl -n your-namespace exec -it your-pod -- sh</code></p>
</li>
</ol>
<p>If the pods contains more than one container, you can use additional parameter <code>-c</code>. <br>
You can read more into the documentation here:
<a href="https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec" rel="nofollow noreferrer">https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#exec</a></p>
<ol start="2">
<li>SSH into the Kubernetes nodes <br>
As for this, the method to get into the nodes depends on whether the Kubernetes nodes are <code>public</code> of <code>private</code>.
By <code>public</code>, 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.</li>
</ol>
<p>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 <code>bastion</code>, and acts as a <code>jump server</code>, where you can SSH into, and then you can SSH into your Kubernetes nodes from this <code>bastion</code> or <code>jump server</code>.</p>
<p>As for how to SSH into the nodes from Windows machine, you can use either PuTTY, Cygwin, or MSYS2. <br>
I personally prefer Git Bash for Windows that comes with Git.</p>
<p>References:</p>
<ol>
<li><a href="https://www.putty.org/" rel="nofollow noreferrer">https://www.putty.org/</a></li>
<li><a href="https://www.cygwin.com/" rel="nofollow noreferrer">https://www.cygwin.com/</a></li>
<li><a href="https://www.msys2.org/" rel="nofollow noreferrer">https://www.msys2.org/</a></li>
</ol>
