Login into cloud shell on azure portal.
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.
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
After several minutes, the command completes and returns JSON-formatted information about the cluster. JSON file available in powershell window screen shot.
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
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
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.
Use the kubectl apply command to run the application.
- kubectl apply -f azure-vote.yaml
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
Please see the external IP in command prompt- 137.117.64.102. and browse the IP and get the application.
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.
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
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
}
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
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
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
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
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
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
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.