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
- Click the Cloud Shell icon (
>_
) in the upper right.- Select Bash.
- Click Show advanced settings.
- Change Cloud Shell Region to be the same as the region of your lab provided storage account.
- For Storage account, select Use existing.
- For File share, select Create new and give it a name of "fileshare".
- Click Create storage.
- Click the Cloud Shell icon (
- Create a Virtual Network
In the Azure portal, click the listed resource group name.
- Copy it to your clipboard.
- 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
- Select myVnet from the listed resources and click Subnets.
- Click + Subnet.
- In the Add subnet pane, enter virtualnodesubnet as the new subnet name.
- Leave the rest as their defaults and click OK.
- Create a New AKS Cluster
- From the Azure portal, select Kubernetes services.
- Click + Add > + Add Kubernetes cluster.
- On the Create Kubernetes cluster page, set the following values:
- Resource Group: Your resource group name
- Choose the Cluster preset configuration to be Dev/Test ($)
- Kubernetes cluster name: cluster1
- Change the Node size to B2s
- Set the Node count to 1
- Leave the rest as their defaults and click Next: Node Pools.
- In the Virtual nodes section, click Enabled.
- Click Next: Authentication.
- Under Service principal, click Configure service principal.
- 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.
- Click OK, and then click Next: Networking.
- Set the following values:
- Virtual network: myVnet
- Virtual nodes subnet: virtualnodesubnet (10.0.8.0/24)
- Kubernetes service address range: 10.1.0.0/16
- Kubernetes DNS service IP address: 10.1.0.10
- Docker Bridge address: 172.17.0.1/16
- Network Policy Azure
- Click Next: Integrations.
- In Container monitoring, click Disabled.
- Click Review + create.
- Once validation has passed, click Create.
Note: The AKS cluster may take a while to create.
- Connect to the Cluster and View the Nodes
Click the Cloud Shell icon (
>_
) in the upper right.Connect to the Kubernetes cluster.
View the nodes in the cluster.
- Bonus: Run and Test an App on the Virtual Nodes
- Open VS Code.
- Copy the YAML code from the Additional Resources section of the lab homepage and paste in into the editor.
- Save and close the editor.
- Create the deployment.
- View the pod running on the virtual node.
- Curl the application from a temporary pod.
- Install
curl
on the temporary pod. - Curl the private IP of the pod running in your cluster.
- Open VS Code.