Configuring Azure Kubernetes Service
The course is part of these learning paths
This course is focused on how to get a Kubernetes cluster up and running on Azure. It does not cover all of the details of how Kubernetes works because it’s not necessary to know all of those details to configure a basic Kubernetes cluster.
The course starts with a brief overview of what Kubernetes does and what a Kubernetes cluster looks like. After that, you’ll see a demo of how to create a cluster using AKS. Finally, you’ll see how to manage a cluster using the kubectl command.
- Create and configure an Azure Kubernetes Service cluster
- Anyone who would like to learn the basics of using Azure Kubernetes Service
- General IT knowledge
- Linux experience (recommended)
- A Microsoft Azure account is recommended if you want to do the demos yourself (sign up for a free trial at https://azure.microsoft.com/free if you don’t have an account)
The GitHub repository for this course is at https://github.com/cloudacademy/configuring-aks.
Once your Kubernetes cluster is running, you can interact with it using the kubectl command. This command is preinstalled in Azure Cloud Shell, so that’s what we’re going to use.
Before we can use the kubectl command, we need to tell it which cluster we want to connect to and which credentials to use. We do that by using this command. We give it the name of the cluster and the resource group that it’s in. We’re asking it to send us the credentials we need to access the cluster. The only reason I’m able to get credentials using this command is because I have the right permissions in Azure role-based access control. Those permissions gave me the ability to create the cluster in the first place and to access it.
Okay, it downloaded the credentials to a configuration file in my home directory. Now we can run a simple command to make sure it’s working. This will give us a list of the nodes in the cluster. There are three nodes, which is what we expected. They all have a status of “Ready”, so it looks like we’re good to go.
Now we can run an application by deploying some containers to the cluster. Microsoft has provided a simple application called Azure Vote. It consists of two containers, one with a web-based frontend and one with a backend database. These containers are available in the Microsoft Container Registry.
To deploy them to our cluster, we need to create what’s called a Kubernetes manifest file. I’ve put a copy of this file in the GitHub repository. Let’s have a quick look. I won’t explain all of the details of this file, but notice that it references two containers. The one for the database backend is here, and the one for the web frontend is here.
To download it to Cloud Shell, run this git clone command. Okay, it’s done. It created a directory called configuring-aks, so let’s go into that directory. There’s the manifest file. Now to get Kubernetes to make our cluster match what’s in the manifest file, we use the “kubectl apply” command, and we specify the name of the manifest file.
All right, that seemed to work. Now to make sure, we can connect to the application. First, we need to get the IP address of where it’s running. In the manifest file, we told Kubernetes to create a service called azure-vote-front. This service makes it possible to access the application. To see the details of the service, we use the “kubectl get service” command.
Here’s the external IP where it’s running. If we copy that and paste it in a new browser tab, we see the application. It’s a pretty simple app, but it does work. Once we had the cluster running, it was very easy to deploy the app to it.
Before we go, we’d better delete this cluster so it doesn’t end up costing a lot of money. Fortunately, that’s very easy to do. Just go to “Resource groups”, then select “aks1” and click “Delete resource group”. This will delete both the resource group and the AKS cluster. You have to type “aks1” before you can click the Delete button.
And that’s it for this demo.
Guy launched his first training website in 1995 and he's been helping people learn IT technologies ever since. He has been a sysadmin, instructor, sales engineer, IT manager, and entrepreneur. In his most recent venture, he founded and led a cloud-based training infrastructure company that provided virtual labs for some of the largest software vendors in the world. Guy’s passion is making complex technology easy to understand. His activities outside of work have included riding an elephant and skydiving (although not at the same time).