Skip to main content

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.

    info

    To 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
    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

Sleeping a vCluster​

Put a virtual cluster to sleep with the vCluster CLI:

Sleep a virtual cluster
vcluster platform sleep my-vcluster -n my-vcluster-namespace
CLI reference

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.

Restarting pods

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:

Wake up a virtual cluster
vcluster platform wakeup my-vcluster -n my-vcluster-namespace
CLI reference

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:

Connect to wake up a virtual cluster
vcluster connect my-vcluster -n my-vcluster-namespace