<p>I have a Kubernetes cluster in Azure using AKS and I'd like to 'login' to one of the nodes. The nodes do not have a public IP. </p>

<p>Is there a way to accomplish this?</p>

Greg Bala
<p>The procedure is longly decribed in an article of the Azure documentation:
<a href="https://learn.microsoft.com/en-us/azure/aks/ssh" rel="noreferrer">https://learn.microsoft.com/en-us/azure/aks/ssh</a>. It consists of running a pod that you use as a relay to ssh into the nodes, and it works perfectly fine:</p>

<p>You probably have specified the ssh username and public key during the cluster creation. If not, you have to configure your node to accept them as the ssh credentials:</p>

<pre><code>$ az vm user update \
  --resource-group MC_myResourceGroup_myAKSCluster_region \
  --name node-name \
  --username theusername \
  --ssh-key-value ~/.ssh/id_rsa.pub
</code></pre>

<p>To find your nodes names:</p>

<pre><code>az vm list --resource-group MC_myResourceGroup_myAKSCluster_region -o table
</code></pre>

<p>When done, run a pod on your cluster with an ssh client inside, this is the pod you will use to ssh to your nodes:</p>

<pre><code>kubectl run -it --rm my-ssh-pod --image=debian
# install ssh components, as their is none in the Debian image
apt-get update &amp;&amp; apt-get install openssh-client -y
</code></pre>

<p>On your workstation, get the name of the pod you just created:</p>

<pre><code>$ kubectl get pods
</code></pre>

<p>Add your private key into the pod:</p>

<pre><code>$ kubectl cp ~/.ssh/id_rsa pod-name:/id_rsa
</code></pre>

<p>Then, in the pod, connect via ssh to one of your node:</p>

<pre><code>ssh -i /id_rsa theusername@10.240.0.4
</code></pre>

<p>(to find the nodes IPs, on your workstation):</p>

<pre><code>az vm list-ip-addresses --resource-group MC_myAKSCluster_myAKSCluster_region -o table
</code></pre>
