loft-sh / vcluster

vCluster - Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.
https://www.vcluster.com
Apache License 2.0
6.15k stars 368 forks source link
cloud-native helm k3s k8s kubectl kubernetes multi-tenancy platform-engineering vcluster virtual-clusters


WebsiteQuickstartDocumentationBlogTwitterSlack

Latest Release License: Apache-2.0

Join us on Slack! Open in DevPod!

Create fully functional virtual Kubernetes clusters - Each vcluster runs inside a namespace of the underlying k8s cluster. It's cheaper than creating separate full-blown clusters and it offers better multi-tenancy and isolation than regular namespaces.

Why Virtual Kubernetes Clusters?

Learn more on www.vcluster.com.


vcluster Intro

vcluster Compatibility

Learn more in the documentation.


⭐️ Do you like vcluster? Support the project with a star ⭐️


Features


Quick Start (~ 1 minute)

To learn more about vcluster, open the full getting started guide.

1. Download vcluster CLI

VCluster has a hard dependency on helm (v3.10.0+), if it is not installed on your machine, you can install it beforehand or let vCluster install it for you.

Use one of the following commands to download the vcluster CLI binary from GitHub:

Mac (Intel/AMD) ```bash curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-darwin-amd64" && sudo install -c -m 0755 vcluster /usr/local/bin ```
Mac (Silicon/ARM) ```bash curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-darwin-arm64" && sudo install -c -m 0755 vcluster /usr/local/bin ```
Linux (AMD) ```bash curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-linux-amd64" && sudo install -c -m 0755 vcluster /usr/local/bin ```
Linux (ARM) ```bash curl -L -o vcluster "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-linux-arm64" && sudo install -c -m 0755 vcluster /usr/local/bin ```
Windows (Powershell) ```bash md -Force "$Env:APPDATA\vcluster"; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12'; Invoke-WebRequest -URI "https://github.com/loft-sh/vcluster/releases/latest/download/vcluster-windows-amd64.exe" -o $Env:APPDATA\vcluster\vcluster.exe; $env:Path += ";" + $Env:APPDATA + "\vcluster"; [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User); ``` > If you get the error that Windows cannot find vcluster after installing it, you will need to restart your computer, so that the changes to the `PATH` variable will be applied.


Alternatively, you can download the binary for your platform from the GitHub Releases page and add this binary to your PATH.


2. Create a vcluster

vcluster create my-vcluster

# OR: Use --expose to create a vcluster with an externally accessible LoadBalancer
vcluster create my-vcluster --expose

# OR: Use --isolate to create an isolated environment for the vcluster workloads
vcluster create my-vcluster --isolate

Take a look at the vcluster docs to see how to deploy a vcluster using Helm or Kubectl instead.

3. Use the vcluster

Run in a terminal:

# Run any kubectl, helm, etc. command in your vcluster
kubectl get namespace
kubectl get pods -n kube-system
kubectl create namespace demo-nginx
kubectl create deployment nginx-deployment -n demo-nginx --image=nginx
kubectl get pods -n demo-nginx

4. Cleanup

vcluster delete my-vcluster

Alternatively, you could also delete the host-namespace using kubectl.

Architecture

vcluster Intro

Contributing

Thank you for your interest in contributing! Please refer to CONTRIBUTING.md for guidance.



This project is open-source and licensed under Apache 2.0, so you can use it in any private or commercial projects.