Create an AKS Cluster that uses Azure Container Instances

1.5 hours
  • 5 Learning Objectives

About this Hands-on Lab

Your company has started using Kubernetes for their microservices applications running on containers. To prevent having to manage nodes in VM scale sets and paying for infrastructure which may go unused, they decided to use virtual nodes with managed container instances. With virtual nodes, they can scale up their Kubernetes cluster instantly, which is attractive to the company. You’ve been tasked with helping implement Azure Container Instances with the company’s AKS Cluster.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Start Cloud Shell
  1. Click the Cloud Shell icon (>_) in the upper right.
    1. Select Bash.
    2. Click Show advanced settings.
    3. Change Cloud Shell Region to be the same as the region of your lab provided storage account.
    4. For Storage account, select Use existing.
    5. For File share, select Create new and give it a name of "fileshare".
    6. Click Create storage.
Create a Virtual Network
  1. In the Azure portal, click the listed resource group name.

    1. Copy it to your clipboard.
    2. Create a virtual network, replacing <RESOURCE_GROUP_NAME> with the name you just copied.

    In the Azure portal, refresh All resources to view the newly created myVnet virtual network.

Add a New Subnet for Virtual Nodes

  1. Select myVnet from the listed resources and click Subnets.
  2. Click + Subnet.
  3. In the Add subnet pane, enter virtualnodesubnet as the new subnet name.
  4. Leave the rest as their defaults and click OK.
Create a New AKS Cluster
  1. From the Azure portal, select Kubernetes services.

  2. Click + Add > + Add Kubernetes cluster.

  3. On the Create Kubernetes cluster page, set the following values:

    • Resource Group: Your resource group name
    • Kubernetes cluster name: cluster1
    • Node count: 1
  4. Leave the rest as their defaults and click Next: Node Pools.

  5. In the Virtual nodes section, click Enabled.

  6. Click Next: Authentication.

  7. Under Service principal, click Configure service principal.

  8. In the Configure service principal menu, set the following values:

    • Service principal: Use existing
    • Service principal client ID: See the Credentials section of the lab homepage for the service principal username.
    • Service principal client secret: See the Credentials section of the lab homepage for the service principal password.
  9. Click OK, and then click Next: Networking.

  10. Set the following values:

    • Virtual network: myVnet
    • Virtual nodes subnet: virtualnodesubnet (
    • Kubernetes service address range:
    • Kubernetes service IP address:
    • Network PolicyL Azure
  11. Click Next: Integrations.

  12. In Container monitoring, click Disabled.

  13. Click Review + create.

  14. Once validation has passed, click Create.

    Note: The AKS cluster may take a while to create.

Connect to the Cluster and View the Nodes
  1. Click the Cloud Shell icon (>_) in the upper right.

  2. Connect to the Kubernetes cluster.

  3. View the nodes in the cluster.

Bonus: Run and Test an App on the Virtual Nodes
  1. Open VS Code.
    1. Copy the YAML code from the Additional Resources section of the lab homepage and paste in into the editor.
    2. Save and close the editor.
    3. Create the deployment.
    4. View the pod running on the virtual node.
    5. Curl the application from a temporary pod.
    6. Install curl on the temporary pod.
    7. Curl the private IP of the pod running in your cluster.

Additional Resources

You've been given credentials for the Azure portal. Log in and create a virtual network with two subnets, one for the cluster and one for the virtual node network.

Use the deploy.yml file in the GitHub repository to test the application.

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?