Create Kubernetes Cluster
Kubernetes is an open source container orchestrator that automates deployment, scaling, and management of operations. A Kuberenetes cluster can be created through Azure Portal or through Azure Cloud Shell.
Using Azure Portal
When using Azure Portal, following steps will let you create a Kubernetes cluster in Azure.
- From the Azure portal, go to Resource groups from the left most pane of the window.
- From the list of resource groups, left click on your resource group.
- Left click on the + Add button on the top left corner.
In the search bar, under the New tag, type Kubernetes Service.
Press enter to get the following screen as the search result.
Left click on the Create button. On clicking the button, you will be redirected to a Create Kubernetes cluster page.
At the Create Kubernetes Cluster page you are going to create the required Kubernetes cluster. Add these details according to your requirements.
Mainly, you only need to provide a name for your Kubernetes cluster and the rest can be left as default but to have more control over your cluster, you can modify Region, Node count and Node size accordingly. Also, you have the options to scale, monitor, add authentication, networking and tags in your Kubernetes cluster to have a more optimized cluster.
Click on the Review + Create button at the bottom of the window to review the provided details.
Once the validation criterion is met, you will be notified as thus,
- Click on Create to create your Kubernetes cluster. It will take a few minutes to create your Kubernetes cluster.
Using Azure Cloud Shell
- After the resource group has been successfully created, create a service principal and configure its access to Azure resources through the following command
batchfile az ad sp create-for-rbacThis command will return an output such as:
- Use the appId and password from the results of the previously executed command in the command below. This will create an Azure Kubernetes Service cluster for you.
az aks create --resource-group aks --name youraks --node-count 2 --service-principal 'appId' --client-secret 'password'
Connect to Kubernetes Cluster
After the Kubernetes cluster is created successfully, you need to connect it.
- Use the following command to get the credentials of your newly created AKS cluster and get them saved on the local machine.
az aks get-credentials --name akscluster --resource-group aks
The next step after creating Kubernetes cluster is to create NCache deployment, explained in the next chapter.