Deploying a Kubernetes Cluster Using Azure Kubernetes Service

1 hour
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, you will be creating a Kubernetes cluster using Azure Kubernetes Service (AKS). You will create the cluster through Azure Cloud Shell.

You will learn how to easily create a cluster with just a few commands.

Understanding how to create your cluster through the command line will give you the advantage of having granular control over your cluster and understanding exactly whats going on under the hood.

For this lab, you should have a basic understanding of Kubernetes. This way, you have the basic knowledge and skills to comprehend what you will be achieving in this lab.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create an AKS Cluster

Create a two-node cluster in the East US region using the Azure portal.

Configure Autoscaling

Configure the node pool to have a minimum of 2 and maximum of 4 nodes with Autoscale enabled.

Deploy the Test Application
  1. Launch Azure Cloud Shell.
  2. Paste the provided YAML code into the deployment file for the application.
  3. Deploy the app through Cloud Shell.
Test the Cluster

Use the DNS name of the service load balancer to test the cluster and see if the app works!

Additional Resources

As a Cloud Engineer for a tech startup, you’ve been tasked with setting up a new Azure Kubernetes Service (AKS) cluster to host an application. This is very important, as your team wants to run the same app that they run on-premises. So, this solution must work.

To accomplish this, you will complete the following tasks:

  • Create an AKS cluster in the East US region.
  • Deploy a test application to mimic the application.
  • Configure autoscaling to a max of 4 nodes.
  • Test the cluster to see if what you created works!

Use the following YAML code to configure the application:

apiVersion: v1
kind: Service
metadata:
  name: vote-service
  labels:
    app: vote
spec:
  selector:
    app: vote
  ports:
    - name: http
      port: 80
      targetPort: 80
    - name: udp
      port: 5000
      targetPort: 5000
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: vote-deployment
  labels:
    app: vote
spec:
  replicas: 2
  selector:
    matchLabels:
      app: vote
  template:
    metadata:
      labels:
        app: vote
    spec:
      containers:
        - name: vote
          image: dockersamples/examplevotingapp_vote:before
          ports:
            - name: http
              containerPort: 80
            - name: udp
              containerPort: 5000

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?