Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

AWS Logo
Menu
Deploy a vCluster on EKS Using Helm

Deploy a vCluster on EKS Using Helm

In modern Kubernetes deployments, multi-tenancy is a common challenge. Virtual clusters(vClusters) offer a lightweight way to create isolated environments without the overhead of multiple Kubernetes clusters. In this post, I’ll guide you through deploying a vCluster on Amazon EKS using Helm and connecting to it locally.

Published Jan 3, 2025

What Is a vCluster?

A vCluster is a virtual Kubernetes cluster that runs on top of another Kubernetes cluster(the host cluster). It can use K8s / K3s or K0s distributions, allowing you to run multiple virtual clusters on a single host cluster. This is ideal for testing, development or tenant isolation.

Prerequisites

Before we start, ensure you have the following:
  • An EKS Cluster up and running(v1.28+).
  • kubectl and Helm installed locally.
  • Access to the EKS cluster
  • vCluster CLI installed.

Deploy the vCluster

Add the vCluster Helm Repository:
helm repo add loft-sh https://charts.loft.sh
Create a dedicated namespace and install the vCluster Helm Chart:
kubectl create ns vcluster
helm install sample-vcluster loft-sh/vcluster -n vcluster
Verify the Installation by checking the vCluster pods:
kubectl get pods -n vcluster
Image not found

Connect to vCluster Locally

To interact with the vCluster, you need to connect to its control plane. This is done by port-forwarding its API server.
Port-Forward the vCluster API Server:
vcluster connect sample-vcluster -n vcluster
This command:
  • Sets up port-forwarding to the vCluster.
  • Creates a temporary kubeconfig for the vCluster.
While the above port forwarding is executed, it is possible to check the vCluster components in a separate shell.
Image not found
Now you are connected to vCluster and just as normal Kubernetes cluster you can deploy workloads to vCluster. It is possible to connect vCluster to ArgoCD or any other tool if the vCluster API endpoint is exposed outside.

vCluster.yaml

This configuration file is used to configure different options and parameters when deploying a vCluster. Since helm is used to deploy the vCluster, values.yaml has different sections to achieve the same configuration changes.
Example:
1. Sync different Kubernetes objects between host cluster and vCluster,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
sync:
services:
enabled: true
configmaps:
enabled: true
all: false
secrets:
all: false
enabled: true
endpoints:
enabled: true
pods:
enabled: true
ephemeralContainers: false
status: false
events:
enabled: true
persistentvolumeclaims:
enabled: true
ingresses:
enabled: true
2. Configure external database as the ETCD storage. More info.
1
2
3
4
5
6
7
8
9
syncer:
storage:
persistence: false
env:
- name: K3S_DATASTORE_ENDPOINT
valueFrom:
secretKeyRef:
name: postgres-db
key: sample-vcluster-endpoint
3. Enable disable isolation with extra resource quotas
1
2
3
isolation:
enabled: false
namespace: vcluster
Using helm values.yaml file it is possible to create an ingress resource and expose the vCluster API outside of host cluster. By doing so it is possible to connect to vCluster without port-forwarding.

Conclusion

vCluster provides an efficient way to manage Kubernetes multi-tenancy, allowing developers and teams to work in isolated environments. By using Helm, deploying a vCluster is simple and integrates seamlessly with existing Kubernetes infrastructure like EKS.
 

Comments

Log in to comment