AKS is a Platform as a Service (PaaS) from Azure. It provides hassle-free Kubernetes Cluster. Usually we do not need to get into the worker nodes of the Azure Kubernetes Cluster. Azure is not providing a direct option to login to the nodes.
In case of some need, we have options to SSH into the Kubernetes worker nodes. Recently I faced issue with Clock synchronization issues with one of my production AKS cluster. So I had to manually ssh into the worker nodes to apply the correction.
There is one ready made script available in github which will do all the work for us.
Prerequisite – Configure kubectl. The steps are already explained in one of my previous posts
Step 1: Download the script from Github
Step 2: Enable execute permission to the script and create a permanent link
chmod +x ./kubectl-wls
The below step is optional. You can skip the below step if you don’t have root access to the machine
sudo mv ./kubectl-wls /usr/local/bin/kubectl-wls
Step 3: Execute the script. Select the node and get inside the worker node.
The command will give an output similar to the below one. I have a 10 node cluster and this list shows all the worker nodes that are part of the cluster. We can select the number to enter into the selected node. Now you are inside the worker node with root privilege. Enjoy 🙂
To exit from each node, we just need to type exit in the command line.
I hope this document is helpful. Feel free to comment incase if you face any issues.