Deploying vCluster on AWS EKS Using Helm

Introduction

vCluster is a lightweight, virtual Kubernetes cluster solution that allows running multiple Kubernetes clusters within a single Kubernetes host cluster. It is useful for multi-tenancy, development, and testing scenarios without the overhead of managing multiple EKS clusters.

In this guide, we will deploy vCluster on an AWS EKS cluster using Helm.

Prerequisites

Before proceeding, ensure you have the following:

  • AWS CLI installed and configured with appropriate permissions.
  • kubectl installed and configured to access your EKS cluster.
  • Helm installed (v3 recommended).
  • eksctl installed to manage EKS clusters.
  • An existing AWS EKS cluster or create a new one.

Step 1: Create an EKS Cluster (If Needed)

If you don’t have an existing EKS cluster, create one using eksctl:

1
eksctl create cluster --name my-eks-cluster --region us-west-2 --nodegroup-name standard-workers --node-type t3.medium --nodes 2

Verify the cluster:

1
kubectl get nodes

Step 2: Install Helm

If Helm is not installed, you can install it using the following:

1
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

Verify the installation:

1
helm version

Step 3: Add the vCluster Helm Repository

Add the loft Helm repository which contains the vCluster chart:

1
2
helm repo add loft-sh https://charts.loft.sh
helm repo update

Step 4: Deploy vCluster Using Helm

Create a namespace for vCluster:

1
kubectl create namespace vcluster

Deploy vCluster using Helm:

1
helm install my-vcluster loft-sh/vcluster -n vcluster

Verify the deployment:

1
kubectl get pods -n vcluster

You should see the vCluster pods running.

Step 5: Connect to vCluster

To interact with the vCluster, use the following command:

1
vcluster connect my-vcluster -n vcluster -- kubectl get nodes

This command sets up port forwarding and allows you to interact with the virtual cluster using kubectl.

Step 6: Deploy Workloads in vCluster

Once connected to vCluster, you can deploy workloads as you would on any Kubernetes cluster.

Example:

1
kubectl apply -f https://k8s.io/examples/application/deployment.yaml

Verify the deployment:

1
kubectl get pods

Step 7: Deleting vCluster

To remove vCluster from your EKS cluster:

1
2
helm uninstall my-vcluster -n vcluster
kubectl delete namespace vcluster

If you created an EKS cluster specifically for this, you can delete it with:

1
eksctl delete cluster --name my-eks-cluster

Conclusion

In this guide, we deployed vCluster on AWS EKS using Helm, connected to the virtual cluster, and deployed workloads within it. vCluster provides a great way to create isolated environments for testing, development, and multi-tenancy within Kubernetes clusters efficiently.

Happy coding!