Connect azure node using interactive shell

Sep 30, 2022
  • Install azure cli using below command
brew update && brew install azure-cli
  • Do login using below command
az login

Let the login be successful.

  • Get access to the subscription
az account set --subscription <subscription id>
  • Obtain kubeconfig of cluster using below command
az aks get-credentials --resource-group <resource group name> --name <cluster name>
  • Try to get the list of nodes using the command
kubectl get nodes
  • From the above nodes list, copy the name of node to which you need to connect.
  • Execute the below command to start interactive session on the node
kubectl debug node/< node name > -it

This will create a pod start an interactive session with the desired node from the container inside the pod.

  • Finally, you can delete the pod using command
kubectl delete po <pod name>