Skip to main content

High Availability Installation

By default, vCluster Platform will run in a cluster as a single replica without high availability.

Licensed Feature

Running vCluster Platform in high availability mode is an enterprise feature!

Enable High-Availability and run vCluster Platform with multiple replicas

To configure vCluster Platform to be highly available, you only have to scale up the replicas and vCluster Platform will start with leader election mode. You can do that via helm on an existing vCluster Platform installation:

# Run vCluster Platform with 3 replicas
helm upgrade loft vcluster-platform --repo https://charts.loft.sh/ \
--namespace vcluster-platform \
--reuse-values \
--set replicaCount=3

Now check that 3 replicas are running:

$ kubectl get po -n vcluster-platform
NAME READY STATUS RESTARTS AGE
loft-84bfdb746c-7t922 1/1 Running 0 40s
loft-84bfdb746c-jpwlz 1/1 Running 0 40s
loft-84bfdb746c-9c4jx 1/1 Running 0 40s

How does it work?

To understand how vCluster Platform can be made highly available and scaled to multiple replicas, we have to take a look at the core components of vCluster Platform:

  1. Api Server: vCluster Platform starts an internal Kubernetes api server that handles most of the functional requests vCluster Platform receives. Since vCluster Platform saves everything in Kubernetes resources rather than storing any data in volumes, it can easily scale horizontally.

  2. Controller: A significant part of vCluster Platform is reacting to Kubernetes resource changes and changing other Kubernetes resources in return. This part is very similar to the kube-controller-manager which executes the core control loops for Kubernetes. Running multiple instances of this component would result in conflicting changes and race conditions among the controllers, this is why leader-election is used. Leader election allows running multiple instances where a single leader is elected that executes the actual functionality, while all other instances are waiting. When the leader fails for any reason another replica takes over.

For simplicity and performance, both components are compiled into the same binary in vCluster Platform. Scaling of vCluster Platform works a little bit differently than with Kubernetes components by using a combination of leader election and simple horizontal scaling to ensure high-availability.

The modes for a vCluster Platform replica are:

  1. Leader Mode: If a vCluster Platform replica runs as a leader, all functionality is started like normal, so both api server and controllers are running.
  2. Non-Leader Mode: If a vCluster Platform replica runs as a non-leader, all functionality except the controllers are started, so only the api server is running. If the leader fails for any reason and this replica is made the new leader, vCluster Platform simply starts the controller component within this replica.

If configured, vCluster Platform automatically determines which replica to run in leader mode and which to run in non-leader mode. With this approach it is possible to run multiple instances of the api server and allow horizontal scaling for that component, while ensuring the controllers are only run once.