SSH into Azure Kubernetes Worker Node
Sometimes you just need to get full access.
There have some rare occasions where I have needed to get to the host os of a worker node in Azure Kubernetes.
Pre Requites
aks-preview
Azure CLI extensionaz extension add --name aks-preview
Microsoft.ContainerService
provideraz provider register --namespace Microsoft.ContainerService
DisableSSHPreview
feature flagaz feature register --namespace "Microsoft.ContainerService" --name "DisableSSHPreview"
Update SSH public key on an existing AKS cluster
If you have lost the key used during installation of the Azure Kubernetes, you can update the key with the following command:
aks update --name myAKSCluster --resource-group MyResourceGroup --ssh-key-value ~/.ssh/id_rsa.pub
Connect to Node
We need to get the IP address (
EXTERNAL-IP
) of the worker nodekubectl get nodes -o wide
Now we can connect to worker node
ssh -i <private_key> clouduser@<ip_addr>
Where:
- private_key: path to private key
- ip_addr: IP Address of the Node