Microsoft Azure – Availability Zones For Kubernetes Cluster
In this article, we will learn how to create a highly available Kubernetes cluster with availability zones. When you create an Azure Kubernetes service or AKS cluster in Azure, its nodes and storage all reside in the same datacenter. The cluster is protected from hardware failure and maintenance within the data center because the nodes and storage are distributed across fault and update domains.
But this doesn’t help if the datacenter goes down. This almost never happens, but you might still want to protect against it. You can do that by using availability zones for your Kubernetes cluster.
Availability zones are unique physical locations that contain one or more datacenters, and when you use them with AKS, your nodes will be distributed across availability zones. This makes AKS highly available as it will still run if one or even more datacenters fail.
Let’s create a Kubernetes cluster that uses availability zones using the Azure Cloud Shell. You can reach it by going to shell.azure.com, and it contains the latest version of the Azure CLI.
Let’s use it to create a Kubernetes cluster. First, we’ll create a new resource group that we’ll use for the Kubernetes cluster using the below command:
az group create --name <YOUR RESOURCE GROUP> --location <YOUR LOCATION>
Now we’ll create the Kubernetes cluster with the below command:
az aks create --resource-group <YOUR RESOURCE GROUP> --name <YOUR CLUSTER NAME> --generate-ssh-keys --enable-vmss --load-balancer-sku standard --node-count <No. OF NODE> --node-zones <YOUR NODE ZONES>
The node-zones parameter is what will distribute the nodes across availability zones. If you don’t add this parameter, the cluster will be created in one datacenter. This will take a while. The Kubernetes cluster is created and its nodes are distributed across availability zones.
When you use availability zones for your Kubernetes cluster, you can make it highly available and protected against the failure of a single datacenter.