Lab6 - Implement Azure Kubernetes Service
Lab6 - Implement Azure Kubernetes Service
Objectives
In this lab, you will:
Architecture diagram
1
Instructions
Task 1: Register the Microsoft.Kubernetes and Microsoft.KubernetesConfiguration resource providers.
In this task, you will register resource providers necessary to deploy an Azure Kubernetes Services cluster.
Note: If this is the first time you are starting Cloud Shell and you are presented with the You have no storage
mounted message, select the subscription you are using in this lab, and click Create storage.
4. From the Cloud Shell pane, run the following to register the Microsoft.Kubernetes and
Microsoft.KubernetesConfiguration resource providers.
In this task, you will deploy an Azure Kubernetes Services cluster by using the Azure portal.
Setting Value
Subscription the name of the Azure subscription you are using in this lab
Resource group the name of a new resource group clo800-06-rg1
Kubernetes cluster name Clo800-06-aks1
Region the name of a region where you can provision a Kubernetes cluster
Kubernetes version accept the default
Node size accept the default
Node count 1
Setting Value
2
Enable virtual nodes Disabled (default)
Enable virtual machine scale sets Enabled (default)
Setting Value
Authentication method System-assigned managed identity (default)
Role-based access control (RBAC) Enabled
Setting Value
Network configuration kubenet
DNS name prefix Clo800-<studentID>
Note: In production scenarios, you would want to enable monitoring. Monitoring is disabled in this case
since it is not covered in the lab.
Note: Wait for the deployment to complete. This should take about 10 minutes.
In this task, you will deploy a pod into the Azure Kubernetes Service cluster.
RESOURCE_GROUP='clo800-06-rg1'
AKS_CLUSTER='clo800-06-aks1'
3
7. From the Cloud Shell pane, run the following to verify connectivity to the AKS cluster:
8. In the Cloud Shell pane, review the output and verify that the one node which the cluster consists
of at this point is reporting the Ready status.
9. From the Cloud Shell pane, run the following to deploy the nginx image from the Docker Hub:
10. From the Cloud Shell pane, run the following to verify that a Kubernetes pod has been created:
11. From the Cloud Shell pane, run the following to identify the state of the deployment:
12. From the Cloud Shell pane, run the following to make the pod available from Internet:
13. From the Cloud Shell pane, run the following to identify whether a public IP address has been
provisioned:
14. Re-run the command until the value in the EXTERNAL-IP column for the nginx-deployment entry
changes from <pending> to a public IP address. Note the public IP address in the EXTERNAL-
IP column for nginx-deployment.
15. Open a browser window and navigate to the IP address you obtained in the previous step. Verify
that the browser page displays the Welcome to nginx! message.
Review
Clean up resources
Note: Remember to remove any newly created Azure resources that you no longer use. Removing unused
resources ensures you will not see unexpected charges.
4
az group list --query "[?starts_with(name,'clo800-06')].name" --output tsv
3. Delete all resource groups you created throughout the labs of this module by running the following
command:
az group list --query "[?starts_with(name,'clo800-06')].[name]" --output tsv | xargs -L1 bash -c 'az group delete --name
$0 --no-wait --yes'
Note: The command executes asynchronously (as determined by the --nowait parameter), so while you will
be able to run another Azure CLI command immediately afterwards within the same Bash session, it will take
a few minutes before the resource groups are actually removed.