Creating a Kubernetes Cluster is cumbersome and time-consuming. It involves a lot of effort to have the Kubernetes Control Plane up and ready. Sometimes, it may take days based on the level of expertise we have. Creating a Kubernetes Cluster on Azure is easy, and you can spin it up in minutes. Whenever we create an Azure Kubernetes Service, we actually create a Control Plane and Cluster Nodes. We run the containerized applications on the Cluster Nodes. The underlying Azure Platform abstracts all necessary complexities involved to create and maintain the Kubernetes Control Plane. In this article, we will create an Azure Kubernetes Service Cluster. In the subsequent articles, we will containerize the .NET Core application and host it in the Azure Kubernetes Service Cluster.
As of now, we have been discussing the theoretical aspects of Azure Kubernetes Service and seen a detailed understanding of the basic concepts for Azure Kubernetes Service.
Creating an Azure Kubernetes Service Cluster:
Open Azure Portal – https://portal.azure.com and click on Create a resource.
All the Containers based offerings are listed in the Containers section. Click on Containers and then click on Kubernetes Service.
Provide the name of the Azure Subscription where you need to create the Azure Kubernetes Service, Resource Group Name, Kubernetes cluster name, Region where your Kubernetes Cluster would be created, and all other necessary information.
Select the size of the Node-based on your requirement and provide a number of Nodes you need in the Cluster. Click on Review + create.
Verify the details for the Kubernetes Service and click on Create.
Once the Kubernetes Cluster gets created click on Go to the resource. You will get navigated to the newly created Azure Kubernetes Service Cluster.
Now let us verify the Cluster. We can check the Nodes created in the Cluster. Click on the Cloud Shell icon to open the Cloud Shell. The Cloud Shell comes loaded with all necessary utilities like Azure CLI, Helm Charts, Kubectl command that we can use to interact with Azure Kubernetes Service Cluster. You can interact with any Azure Service using the Cloud Shell.
Run the following command to get the credentials of the Azure Kubernetes Service locally to the Cloud Shell. This would provide all the necessary credentials to interact with the Kubernetes Control Plane. Provide the name of the Resource Group and the Azure Kubernetes Service in the placeholders.
az aks get-credentials -g [Resource Group] -n [Name of Azure Kubernetes Service]
We use the kubectl command to interact with the Azure Kubernetes Service Cluster. Let us execute the following command to get the Nodes in the Cluster. We had opted for a single Node in the Cluster while creating the Azure Kubernetes Service. So, we should be able to see a single Node here.
kubectl get nodes
Conclusion
In this article, we learned how to create a basic Azure Kubernetes Service Cluster. In the subsequent articles, we will containerize a .NET Core application, push it to Azure Container Registry, and then run it in the Azure Kubernetes Service Cluster.