Share:
Twitter
LinkedIn
Facebook
Google+
Reddit
Whatsapp
Follow by Email

This article is the first in a 2 part series regarding Azure Kubernetes Service (AKS) clusters. Part 1 (this one) will show you how to create an AKS cluster and connect to it via the cloud shell. It will also show you how to connect to the Kubernetes dashboard.

Part 2 will show you how to deploy a simple application, test the application, monitor the health and logs, and delete the cluster.

I am starting to investigate using AKS  for a project at work and thought the best thing to do is to start playing with it and document my journey. So look out for more articles as I go further into the world of AKS.

Create an AKS Cluster

In the Azure portal click on the green +. Then type Kubernetes Service and press Enter.

Click on the Kubernetes Service icon Create.

You will now need to fill in some information to create the Kubernetes cluster.

Lets start with the Basics tab.

  • Under Project Details pick the Subscription you want to use and either create a new Resource group or use an existing.
  • For Cluster Details enter a name for your Kubernetes Cluster, select the Azure region you want the cluster to reside in. You will also be able to pick the Kubernetes version and then you can enter a DNS name for your AKS cluster.
  • The last section on this tab is Scale. Here you can pick the size of your nodes and also how many nodes you want in your cluster. (You can change the node count after the cluster has been deployed.)

Once configured you should have something like in the image below. Click on Next: Authentication when your happy to move on.

Now for the Authentication tab.

  • Here you can either create a new Service principal or Configure to use an existing one. When using an existing one, you will need to provide the SPN client ID and secret.
  • If your running in production you will probably want to click Yes to Enable RBAC. But as this is just in my lab I am going to click no.

Once your happy with your settings click on Next: Networking.

The Networking tab.

  • Leave the HTTP application routing set to Yes. This will configure an integrated ingress controller with automatic public DNS name creation. If you do not want this click No.
  • You could just leave the default Basic networking, but you may find that the AKS cluster will overlap the subnets you have already set up. So I would click Advanced. Here you can either pick or create a new Virtual network, Cluster subnet, Kubernetes service address range, Kubernetes DNS service IP address, and Docker Bridge address.

To move on to the next tab click Next: Monitoring.

On to Monitoring

  • I would always leave the default Yes for Enable container monitoring.
  • Next, you can either use an existing Log Analytics workspace or Create a New one.

To move on click Next: Tags.

Tags!

  • Enter any Tags you are using in your environment.

Click Next: Review + create to move on to the last tab.

Time to create your AKS cluster

  • Azure will validate your settings. Once it’s passed, just give it a review yourself and then click Create.

It will take a few minutes for the cluster to be created and ready to use. Once its created navigate to the resource group you used for the AKS cluster. You will then be able to click on the AKS resource to see the AKS cluster dashboard.

Connect to the AKS Cluster and view the Kubernetes Dashboard

Connect to the cluster

Open up the Azure Cloud Shell and make sure you are in the Bash console.

You can use the following command to configure Kubectl to connect to your Kubernetes Cluster. Just make sure you change the –resource-group  and –name to match yours.

az aks get-credentials --resource-group PixelContainers --name PixelCluster
view raw AKS_part1.ps1 hosted with ❤ by GitHub

To verify your connected you can use the following command.

kubectl get nodes
view raw AKS_part1.ps1 hosted with ❤ by GitHub

Connect to the Kubernetes Dashboard

To connect to the Kubernetes dashboard you have to use Azure cli on you local machine. If you do not have this installed follow the guide here. You are unable to use the cloud shell due to the fact you need a browser.

Open up PowerShell as an administrator and type the following command to install the kubectl to cli.

az aks install-cli
view raw AKS_part1.ps1 hosted with ❤ by GitHub

Follow the instructions so kubectl.exe can be found.

Now enter the following command to connect to Azure.

az login
view raw AKS_part1.ps1 hosted with ❤ by GitHub

Once logged in use the following command to configure Kubectl to connect to your Kubernetes Cluster. Just make sure you change the –resource-group  and –name to match yours.

az aks get-credentials --resource-group PixelContainers --name PixelCluster
view raw AKS_part1.ps1 hosted with ❤ by GitHub

Now to open up the Kubernetes Dashboard use the following command. Just make sure you change the –resource-group  and –name to match yours.

az aks browse --resource-group PixelContainers --name PixelCluster
view raw AKS_part1.ps1 hosted with ❤ by GitHub

In a few seconds, a browser window will open with the Kubernetes dashboard.

That’s it you have now created your first AKS cluster, connected to it via the Cloud Shell and also connected to the Kubernetes dashboard.

In Part 2 of this post series I will show you how to deploy a simple application to the AKS cluster.

I hope you found this article helpful. If you have any questions please reach out in the usual methods.

Share:
Twitter
LinkedIn
Facebook
Google+
Reddit
Whatsapp
Follow by Email

Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

Leave a Reply

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

*

I agree