Design and Implement Kubernetes Applications on Azure Container Service (AKS)
Learn On Demand
Learn On Demand Pro Series

Time
45 minutes
Difficulty
Beginner

This IT Pro Challenge helps learners understand how to use the Azure Kubernetes Service (AKS) to create a cluster and use Cloud Shell to connect to the cluster with the Kubernetes command-line tool (kubectl), then run an application in the cluster, and verify the connection. In the process, learners gain familiarity with several kubectl commands.

Become one of the 3 million IT and Cyber professionals advancing their careers

Sign up with
Or

Already have an account? Sign In »

Overview

In this IT Pro Challenge, learners will understand the basic architecture of the Kubernetes open platform (nodes, clusters, and pods) and how to use the Azure Kubernetes Service (AKS) to create a cluster. Learners will use Cloud Shell to configure the Kubernetes command-line tool, kubectl, to connect to the cluster, run an application on it, and obtain the public IP address so they can verify the configuration as a proof of concept. The skills acquired in this lab are useful for roles as a network or system administrator.

Overview

For this lab, the scenario is that you are a system administrator, and your company is migrating its web services from an on-premise datacenter to Azure. To accomplish this, you need to use the Azure Kubernetes Service (AKS) to create and deploy Kubernetes applications.

Kubernetes is an open platform initially designed by Google as a "platform for automating deployment, scaling, and operations of application containers across clusters of hosts." Kubernetes is based on the concept of container-based orchestration of application development and management. A container is a workload. AKS simplifies the process of container-based application deployment and management.

Create an AKS cluster by using the Azure portal

To begin, you need to sign in to the Azure portal and create an AKS cluster, where you will configure the Node size, authentication, networking, and monitoring.

An AKS cluster uses Kubernetes Role-Based Access Controls (RBAC), which allows you to define access and permissions for users.

A Kubernetes Node (also known as a Worker or a Minion) is a machine that deploys containers. AKS nodes run on Azure virtual machines that can support different operating systems and Windows Server containers.

Connect to the AKS cluster by using Azure Cloud Shell

In the Azure portal, you will launch Azure Cloud Shell (you can use Bash or PowerShell) and create a storage account and a file share for the existing resource group. Then you will use the Azure CLI command az aks get-credentials [resource group] [name] to configure kubectl (the Kubernetes command-line tool) to connect to the AKS cluster you created in the first step. Finally, you will use the kubectl get nodes command to verify the connection to the cluster and return a list of cluster nodes.

Run an application in the AKS cluster

In this step, you will use CloudShell and the kubectl command to deploy an nginx image: kubectl run nginx-[nnnnnnnn] --image=nginx --replicas=[n] --port=[nn] command. Then you will verify that a Kubernetes pod was created by running the kubectl get pods command and make the pod available from the internet by running the kubectl expose deployment nginx-[nnnnnnnn] --port=[nn] --type=LoadBalancer command.

NOTE: A pod is a collection of one or more containers that can share resources.

Lastly, you need to find the public IP address by running the kubectl get services command and repeating it until the value in the EXTERNAL IP column changes from pending to a public IP address (this can take 5-10 minutes). To verify the public IP address is correct, type it into a browser.

Summary Conclusion

By taking this lab, you will learn how to use Azure Cloud Shell to create an AKS cluster, connect to that AKS cluster, and run an application in the AKS cluster. You will also learn how to use the kubectl tool to verify the connection to the cluster, return a list of cluster nodes, and make the pod available from the internet.