Login into cloud shell on azure portal.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image.png)
Create a resource group-
- az group create –name kapilakscluster3 –location eastus
Description: – The following example creates a resource group named kapilakscluster3 in the eastus location.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-1.png)
Output:-
—————————————————————————————————–
{
“id”: “/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myAKSCluster”,
“location”: “eastus”,
“managedBy”: null,
“name”: “kapilakscluster3”,
“properties”: {
“provisioningState”: “Succeeded”
},
“tags”: null
}
Create AKS cluster-
Description:- Use the az aks create command to create an AKS cluster. The following example creates a cluster named kapilakscluster3with one node.
- az aks create –resource-group kapilakscluster3 –name kapilakscluster3 –node-count 1 –generate-ssh-keys
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-2.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-3.png)
After several minutes, the command completes and returns JSON-formatted information about the cluster. JSON file available in powershell window screen shot.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-4.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-5.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-6.png)
Connect to the cluster-
Description:- To configure kubectl to connect to your Kubernetes cluster, use the az aks get-credentials command. This step downloads credentials and configures the Kubernetes CLI to use them
- az aks get-credentials –resource-group kapilakscluster3–name kapilakscluster3
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-7.png)
Connect with the nodes-
Description:- To verify the connection to your cluster, use the kubectl get command to return a list of the cluster nodes. Note that this can take a few minutes to appear.
4) kubectl get nodes
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-8.png)
Run the application-
Description: – A Kubernetes manifest file defines a desired state for the cluster, including what container images should be running. For this example, a manifest is used to create all objects needed to run the Azure Vote application.
Create a file named azure-vote.yaml and copy into it the following YAML code. If you are working in Azure Cloud Shell, this file can be created using vi or Nano as if working on a virtual or physical system.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-9.png)
Use the kubectl apply command to run the application.
- kubectl apply -f azure-vote.yaml
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-10.png)
Test the application: –
Description:- As the application is run, a Kubernetes service is created that exposes the application front end to the internet. This process can take a few minutes to complete. To monitor progress, use the kubectl get service command with the –watch argument.
- kubectl get service azure-vote-front –watch
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-11.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-12.png)
Please see the external IP in command prompt- 137.117.64.102. and browse the IP and get the application.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-13.png)
Monitor health and logs-
Description: – If container insights monitoring has been enabled, health metrics for both the AKS cluster and pods running on the cluster are available on the AKS cluster dashboard. For more information on container health monitoring, see Monitor Azure Kubernetes Service health.
To see current status, uptime, and resource usage for the Azure Vote pods, browse back to the AKS resource, select Monitor Container Health > select the default namespace > and select Containers. It may take a few minutes for this data to populate in the Azure portal.
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-14.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-15.png)
Scale AKS nodes-
Description: – If you created your Kubernetes cluster using the commands in the previous tutorial, it has one node. You can adjust the number of nodes manually if you plan more or fewer container workloads on your cluster.
The following example increases the number of nodes to three in the Kubernetes cluster named myAKSCluster. The command takes a couple of minutes to complete.
- az aks scale –resource-group=myResourceGroup –name=myAKSCluster –node-count 3
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-16.png)
The output is similar to:
“agentPoolProfiles”: [
{
“count”: 3,
“dnsPrefix”: null,
“fqdn”: null,
“name”: “kapilakscluster3”,
“osDiskSizeGb”: null,
“osType”: “Linux”,
“ports”: null,
“storageProfile”: “ManagedDisks”,
“vmSize”: “Standard_D2_v2”,
“vnetSubnetId”: null
}
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-17.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-18.png)
Manually scale pods-
Description: – Thus far, the Azure Vote front-end and Redis instance have been deployed, each with a single replica. To verify, run the kubectl get command.
- kubectl get pods
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-19.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-20.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-21.png)
Auto scale pods-
The following example uses the kubectl autoscale command to autoscale the number of pods in the azure-vote-front deployment. Here, if CPU utilization exceeds 50%, the autoscaler increases the pods to a maximum of 10.
- kubectl autoscale deployment azure-vote-front –cpu-percent=50 –min=3 –max=10
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-22.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-23.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-24.png)
Upgrade cluster: –
Use the az aks upgrade command to upgrade the cluster nodes. The following example updates the cluster to version 1.10.3.
- az aks upgrade –name myAKSCluster –resource-group myResourceGroup –kubernetes-version 1.10.3
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-25.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-26.png)
Output:-
{
“agentPoolProfiles”: [
{
“count”: 3,
“maxPods”: 110,
“name”: “nodepool1”,
“osType”: “Linux”,
“storageProfile”: “ManagedDisks”,
“vmSize”: “Standard_DS1_v2”,
}
],
“dnsPrefix”: “myAKSClust-myResourceGroup-19da35”,
“enableRbac”: false,
“fqdn”: “myaksclust-myresourcegroup-19da35-bd54a4be.hcp.eastus.azmk8s.io”,
“id”: “/subscriptions/<Subscription ID>/resourcegroups/myResourceGroup/providers/Microsoft.ContainerService/managedClusters/myAKSCluster”,
“kubernetesVersion”: “1.10.3”,
“location”: “eastus”,
“name”: “myAKSCluster”,
“type”: “Microsoft.ContainerService/ManagedClusters”
}
Validate Upgrade: –
Description:- Confirm that the upgrade was successful with the az aks show command.
- az aks show –name myAKSCluster –resource-group myResourceGroup –output table
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-27.png)
Update Application: –
A change is made to the application, and the updated application deployed to the Kubernetes cluster.The application source code can be found inside of the azure-vote directory. Open the config_file.cfg file with any code or text editor. In this example vi is used.
- vi azure-vote/azure-vote/config_file.cfg
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-28.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-29.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-30.png)
Delete Cluster: –
Description:- When the cluster is no longer needed, use the az group delete command to remove the resource group, container service, and all related resources.
- az aks delete –resource-group kapilakscluster3 –name kapilakscluster3 –no-wait
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-31.png)
![](https://www.gcpguru.com/wp-content/uploads/2020/10/image-32.png)
12 comments
I am sure this article has touched all the internet viewers, its really really fastidious piece of writing on building up new website.
https://www.crocmall.com
This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
Thanks for your feedback
You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!
Thanks for your feedback
Very well presented. Every quote was awesome and thanks for sharing the content. Keep sharing and keep motivating others.
Thanks
Good post! We will be linking to this particularly great post on our site. Keep up the great writing
Great information shared.. really enjoyed reading this post thank you author for sharing this post .. appreciated
This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post
great articles, and also, if you want free windows or mac software, you can download from my website.