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
- Homebrew
- Mac (Intel/AMD)
- Mac (Silicon/ARM)
- Linux (AMD)
- Linux (ARM)
- Download Binary
- Windows Powershell
brew install loft-sh/tap/vcluster
The binaries in the tap are signed using the Sigstore framework for enhanced security.
curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-darwin-amd64" && sudo install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster
curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-darwin-arm64" && sudo install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster
curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-linux-amd64" && sudo install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster
curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-linux-arm64" && sudo install -c -m 0755 vcluster /usr/local/bin && rm -f vcluster
Download the binary for your platform from the GitHub Releases page and add this binary to your $PATH.
md -Force "$Env:APPDATA\vcluster"; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12';
Invoke-WebRequest -URI "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-windows-amd64.exe" -o $Env:APPDATA\vcluster\vcluster.exe;
$env:Path += ";" + $Env:APPDATA + "\vcluster";
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User);Reboot RequiredYou may need to reboot your computer to use the CLI due to changes to the PATH variable (see below).
Check Environment Variable $PATHLine 4 of this install script adds the install directory
%APPDATA%\vcluster
to the$PATH
environment variable. This is only effective for the current Powershell session, i.e. when opening a new terminal window,vcluster
may not be found.Make sure to add the folder
%APPDATA%\vcluster
to thePATH
environment variable after installing vcluster CLI via Powershell. Afterward, a reboot might be necessary.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​
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:
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:
az group create --name $RESOURCE_GROUP --location $LOCATION
Create the 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:
az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME
Verify the cluster creation​
Verify the cluster by listing the 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:
vcluster create my-vcluster --namespace team-x
Verify the Installation​
Check if vCluster pods are running:
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:
az group delete --name $RESOURCE_GROUP --yes --no-wait