Skip to content

Instantly share code, notes, and snippets.

@marcel-dempers
Forked from tsaarni/README.md
Last active February 23, 2018 03:48
Show Gist options
  • Save marcel-dempers/6658a04bd90c526dacaadba8f1d4ecf4 to your computer and use it in GitHub Desktop.
Save marcel-dempers/6658a04bd90c526dacaadba8f1d4ecf4 to your computer and use it in GitHub Desktop.
How to connect to Azure AKS Kubernetes node VM by SSH

How to connect to Azure AKS Kubernetes worker node by SSH

Nodes are not assigned public IP. If you have accessible VM in the same VNET as worker nodes, then you can use that VM as jump host and connect the worker via private IP. Alternatively public IP can be assigned to a worker node. This readme shows how to do that.

Steps how to attach public IP to a worker node

Run this:

resource_group=<resource group name where aks resources are created>
vm_name=<name of the existing vm here>

az vm nic list --vm-name $vm_name -g $resource_group

Grap the nic name and run this:

vm_nic_name=<name of the nic output above (not full id)>

az network public-ip create -g $resource_group -n ${vm_name}-ip
az network nic ip-config list --nic-name $vm_nic_name -g $resource_group

Grap the output nic ipconfig name and run this:

ip_config_name=<ip config name from above output>
az network nic ip-config update -g $resource_group --nic-name $vm_nic_name --name $ip_config_name --public-ip-address ${vm_name}-ip

Connect with SSH

ssh azureuser@$(az network public-ip show -g $resource_group -n -n ${vm_name}-ip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment