Skip to main content
Version: main 🚧

Deploy vCluster on AKS

This guide provides step-by-step instructions for deploying vCluster on Azure Kubernetes Service (AKS).

Prerequisites​

Before starting, ensure you have the following tools installed:

  • kubectl installed: Kubernetes command-line tool for interacting with the cluster. See Install and Set Up kubectl for installation instructions.
  • vCluster CLI
    brew install loft-sh/tap/vcluster

    The binaries in the tap are signed using the Sigstore framework for enhanced security.

    Confirm that you've installed the correct version of the vCluster CLI.

    vcluster --version
  • Azure CLI (az)
    note

    Ensure you have the necessary permissions to create and manage AKS clusters in your Azure subscription.

Create AKS cluster​

Right subscription

Ensure you are using the correct Azure subscription by running az account show.

Start by creating an AKS cluster using the Azure CLI. First, set up your environment variables:

Set environment variables
export RESOURCE_GROUP=vcluster-demo-rg
export CLUSTER_NAME=vcluster-demo
export LOCATION=eastus
export NODE_SIZE=Standard_D4s_v3
export NODE_COUNT=2

Create a resource group:

Create resource group
az group create --name $RESOURCE_GROUP --location $LOCATION

Create the AKS cluster:

Create AKS cluster
az aks create \
--resource-group $RESOURCE_GROUP \
--name $CLUSTER_NAME \
--location $LOCATION \
--node-count $NODE_COUNT \
--node-vm-size $NODE_SIZE \
--generate-ssh-keys

This command creates an AKS cluster with managed identity enabled and Azure Monitor for containers.

Configure kubectl​

After the cluster is created, get credentials to access the cluster:

Get cluster credentials
az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME

Verify the cluster creation​

Verify the cluster by listing the nodes:

List cluster nodes
kubectl get nodes

You should see output similar to:

NAME                                STATUS   ROLES    AGE   VERSION
aks-nodepool1-34960941-vmss000000 Ready <none> 67m v1.29.9
aks-nodepool1-34960941-vmss000001 Ready <none> 67m v1.29.9

Create virtual cluster​

Create a virtual cluster using the CLI:

Create virtual cluster
vcluster create my-vcluster --namespace team-x

Verify the Installation​

Check if vCluster pods are running:

Check vCluster pods
kubectl get pods -n team-x

You should see output similar to:

NAME                                                   READY   STATUS    RESTARTS   AGE
coredns-666d64755b-k5njg-x-kube-system-x-my-vcluster 1/1 Running 0 3m11s
my-vcluster-0 1/1 Running 0 6m33s

Next steps​

Now that you have vCluster running on AKS, consider exploring the platform UI to manage your virtual clusters.

Cleanup​

If you deployed the AKS cluster with this tutorial, and want to clean up the resources, run the following command:

Clean up resources
az group delete --name $RESOURCE_GROUP --yes --no-wait