Skip to main content
Version: main 🚧

Deploy in high availability

By default, vCluster runs one instance of each of its components. This deployment method is recommended for any uses cases that are very ephemeral (e.g. dev environments, CI/CD, etc.), but for production use cases, it's recommended to run vCluster with more redundancy. We recommend deploying vCluster in high availability (HA) in order to run multiple copies of the vCluster components so that the virtual cluster is more resistant to failures.

Enabling high availability​

When running vCluster with high availability, the default backing store option (i.e. embedded database) must be changed to any of the other backing store options.

Deployed etcd YAML example​

Running in HA with deployed etcd
controlPlane:
# Deploy etcd with 3 replicas
backingStore:
etcd:
deploy:
enabled: true
statefulSet:
highAvailability:
replicas: 3
# Deploy vCluster with 3 replicas
statefulSet:
highAvailability:
replicas: 3

Embedded etcd YAML example​

Enterprise-Only Feature

This feature is an Enterprise feature. See our pricing plans or contact our sales team for more information.

Running in HA with embedded etcd
controlPlane:
# Deploy etcd with 3 replicas
backingStore:
etcd:
embedded:
enabled: true
# Deploy vCluster with 3 replicas
statefulSet:
highAvailability:
replicas: 3

Other predeployment configuration options​

Before deploying, it's recommended to review the set of configuration options that cannot be updated post deployment. These options require deploying a new vCluster instead of upgrading your vCluster with new options.

Control Plane Options​

Decide the various options of how you want your control plane deployed:

  • High availability - Run multiple copies of vCluster components.
  • Rootless mode - Deploy the vCluster pod without root access to the host cluster.
  • Backing Store - Decide how the data of your cluster is stored.
    Backing store options

    vCluster supports etcd or a relational database (using KINE) as the backend.This feature provides flexibility to vCluster operators. The available data store options allow you to select a data store that fits your use case.

    vCluster supports the following datastore options:

    warning

    After deploying your vCluster, there are limited migration paths to change your backing store. Review the backing store migration options before deploying.

    Backing store options

    This is the default, so you don't need to configure anything. If you want to explicitly set this option, you can use:

    controlPlane:
    backingStore:
    database:
    embedded:
    enabled: true

Worker Nodes​

Decide where you want your worker nodes to come from:

  • Nodes from the host cluster - (Default) All worker nodes of the shared host cluster are used by the virtual cluster and all resources are synced to the single namespace that the vCluster is deployed on.
  • Private Nodes - Enable adding individual nodes to the virtual cluster.

Deploy vCluster with HA​

YAML configuration

If you're not sure which options to configure, you can update most settings later by upgrading your vCluster with an updated vcluster.yaml. However, some settings β€” such as what type of worker nodes or the backing store β€” can only be set during the initial deployment and cannot be changed during an upgrade.

All of the deployment options below have the following assumptions:

  • A vcluster.yaml is provided. Refer to the vcluster.yaml reference docs to explore all configuration options. This file is optional and can be removed from the examples.
  • The vCluster is called my-vcluster.
  • The vCluster is be deployed into the team-x namespace.

The vCluster CLI provides the most straightforward way to deploy and manage virtual clusters.

  1. Install the vCluster CLI:

     brew install loft-sh/tap/vcluster-experimental

    If you installed the CLI using brew install vcluster, you should brew uninstall vcluster and then install the experimental version. 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
  2. Deploy vCluster:

    Modify the following with your specific values to generate a copyable command:
    vcluster create my-vcluster --namespace team-x --values vcluster.yaml
    note

    After installation, vCluster automatically switches your Kubernetes context to the new virtual cluster. You can now run kubectl commands against the virtual cluster.

Check the pods of the vCluster on the host cluster​

Ensure that your kubecontext is set to the host cluster.

warning

If you've used the vCluster CLI, your kubecontext automatically switches and connects to the virtual cluster.

You can get the pods in the namespace of the virtual cluster. The namespace is called vcluster-my-vcluster in the host cluster, and contains the components of the vCluster.

kubectl get pods -n vcluster-my-vcluster

Example using the deployed etcd yaml:

NAME                                      READY   STATUS    RESTARTS   AGE
my-vcluster-7c5c5844c5-27j2v 0/1 Running 0 20s
my-vcluster-7c5c5844c5-gb2sm 0/1 Running 0 20s
my-vcluster-7c5c5844c5-pwn7k 0/1 Running 0 20s
my-vcluster-etcd-0 0/1 Running 0 20s
my-vcluster-etcd-1 0/1 Running 0 20s
my-vcluster-etcd-2 0/1 Running 0 20s

There are three replicas running of each component (control plane and etcd) of the vCluster. If one API server pod goes down, the vCluster continues working.

In order to see which nodes in the host cluster that these pods were scheduled on, add the -o wide flag to the kubectl get pods command:

kubectl get pods -n vcluster-my-vcluster -o wide

The hostnames of the nodes will be listed in the NODES column.