Sleep & Wakeup vCluster
The sleep mode temporarily scales down a virtual cluster and deletes all its created workloads on the host cluster. This approach helps save computing resources used by virtual cluster workloads in the host cluster. For example, sleeping development clusters during non-working hours can significantly reduce infrastructure costs.
Prerequisites​
-
Administrator access to a Kubernetes cluster: See Accessing Clusters with kubectl for more information. Run the command
kubectl auth can-i create clusterrole -A
to verify that your current kube-context has administrative privileges.infoTo obtain a kube-context with admin access, ensure you have the necessary credentials and permissions for your Kubernetes cluster. This typically involves using
kubectl config
commands or authenticating through your cloud provider's CLI tools. -
helm
: Helm v3.10 is required for deploying the platform. Refer to the Helm Installation Guide if you need to install it. -
kubectl
: 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
Sleeping a vCluster​
Put a virtual cluster to sleep with the vCluster
CLI:
vcluster platform sleep my-vcluster -n my-vcluster-namespace
Read about using the vcluster platform sleep command.
This command performs the following actions:
- Scales down any StatefulSets or Deployments in the virtual cluster
- Deletes all workloads created by the virtual cluster on the host cluster
While the command preserves object definitions within the virtual cluster, any standalone pods (those without a controlling replica set or StatefulSet) needs to be restarted when the cluster wakes up.
When pods are restarted:
- The temporary filesystem is erased
- Pod IP addresses change
Waking up a vCluster​
You can wake up a virtual cluster with two different vCluster
CLI commands.
As soon as the virtual cluster is woken up, vCluster
scales up any paused StatefulSets or Deployments and the vCluster
syncer recreates the vCluster
pods onto the host cluster.
Direct wake up​
Wake up the virtual cluster with a vCluster
CLI command:
vcluster platform wakeup my-vcluster -n my-vcluster-namespace
Read about using the vcluster platform wakeup command.
Connect to wake up​
Connect to the virtual cluster with a vCluster
CLI command, which automatically wakes up the virtual cluster:
vcluster connect my-vcluster -n my-vcluster-namespace