How To Access Azure Kubernetes Cluster Using Azure Cloud Shell

In the previous article, we did the AKS cluster deployment successfully. Now we have to access our deployed cluster, and for that we will use the Azure Cloud Shell. But first we have to know about Azure Cloud Shell. Let’s start.

What is Azure Cloud Shell?

Azure Cloud Shell is a browser-based shell experience to manage and develop Azure resources.

Cloud Shell offers a browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself. Azure Cloud Shell runs on Ubuntu 16.04 LTS.

You can access the Cloud Shell in the following ways,

  • Direct link: Open a browser to here.
  • Azure portal: Select the Cloud Shell icon on the Azure portal

Access Azure Kubernetes Cluster Using Azure Cloud Shell

Step 1

Sign in and open your Azure management portal here.

Step 2

Once you log-in find and click the small Cloud Shell icon near the search bar, as shown in the picture.

Azure Kubernetes Service AKS with Cloud Shell

Step 3

The portal will ask you to select either PowerShell or Bash as your default shell experience. As we will be working with mainly Linux workloads, please select Bash.

Azure Kubernetes Service AKS with Cloud Shell

Step 4

If this is the first time you have launched Cloud Shell, you will be asked to create a storage account; confirm, and create it.

Azure Kubernetes Service AKS with Cloud Shell

Step 5

You might get an error message that contains a mount storage error. If that error occurs, please restart your Cloud Shell.

Azure Kubernetes Service AKS with Cloud Shell

Click on the power button. It should restart, and you should see something similar to

Azure Kubernetes Service AKS with Cloud Shell

Step 6

The command-line tool that is used to interface with Kubernetes clusters is called kubectl. The benefit of using Azure Cloud Shell is that this tool, along with many others, comes preinstalled and is regularly maintained. kubectl uses a configuration file stored in ~/.kube/config to store credentials to access your cluster.

To get the required credentials to access your cluster; in my case cluster name is rh-k8s-training, you need to type the following command:

az aks get-credentials –resource-group rh-k8s-training –name rh-k8s-training

Step 7

To verify that you have access, type the command: kubectl get nodes. You should see the output as mentioned in the screenshot.

Azure Kubernetes Service AKS with Cloud Shell

Finally, we have verified that we can connect to our AKS cluster.

Leave a Reply

Your email address will not be published. Required fields are marked *