Skip to content

bharathac5775/kubernetes-vind-deployment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Kubernetes Deployment with VIND β€” CineVerse Movie Website

A complete CI/CD pipeline that deploys a static movie website to a virtual Kubernetes cluster created by VIND (Virtual-cluster IN Docker), all running inside a GitHub Actions runner β€” no cloud infrastructure needed.


πŸ“– What is VIND?

VIND stands for Virtual-cluster IN Docker. It is a lightweight tool built on top of vCluster that spins up a fully functional, certified Kubernetes cluster inside a single Docker container. Think of it as "Kubernetes inside Docker" β€” but unlike other local K8s solutions, VIND creates virtual clusters that are isolated, disposable, and incredibly fast to boot.

VIND uses the Docker driver of vCluster to provision an entire Kubernetes control plane + worker node as a container on your machine (or in CI). There's no VM, no heavy hypervisor, and no special kernel requirements beyond a few standard network modules.

πŸ”— VIND Repository

GitHub: https://github.com/loft-sh/vind.git


βš”οΈ VIND vs kind vs Minikube β€” How Are They Different?

Feature VIND (vCluster Docker) kind Minikube
Architecture Virtual cluster running inside a single Docker container Kubernetes nodes as Docker containers Full VM (or Docker container) with kubelet
Startup Time ~30–60 seconds ~60–90 seconds ~2–5 minutes
Resource Usage Very lightweight β€” shares host kernel, minimal overhead Moderate β€” each "node" is a container Heavy β€” runs a full VM by default
Isolation Namespace-level virtual clusters; multiple clusters on one host easily Container-level isolation VM-level or container-level isolation
Multi-Cluster Trivial β€” spin up multiple virtual clusters in seconds Possible but heavier (each cluster = set of containers) Possible via profiles, but slow and resource-heavy
CI/CD Friendly Excellent β€” designed for ephemeral, disposable clusters in pipelines Good β€” commonly used in CI Usable but slower and more brittle in CI
Kubernetes Certified Yes (CNCF conformant) Yes (CNCF conformant) Yes (CNCF conformant)
Driver Docker Docker Docker, VirtualBox, HyperKit, KVM, etc.
Best For CI/CD pipelines, dev/test, ephemeral environments, multi-tenancy Local development, CI testing Local development, full-cluster simulation

Why VIND Stands Out

  • πŸš€ Faster than kind β€” Optimized container-based architecture boots clusters in seconds.
  • πŸ’€ Sleep & Wake β€” Pause clusters to save resources, resume them instantly when needed.
  • 🎨 Built-in UI β€” Free vCluster Platform UI for visual cluster management.
  • ⚑ Load Balancers Out of the Box β€” Automatic LoadBalancer services without extra setup (no MetalLB needed).
  • 🐳 Docker Native β€” Leverages Docker's networking and storage directly.
  • πŸ”„ Pull-through Cache β€” Faster image pulls via the local Docker daemon β€” no redundant downloads.
  • 🌐 Hybrid Nodes β€” Join external nodes (even cloud instances) to your local cluster via VPN.
  • πŸ“Έ Snapshots β€” Save and restore cluster state (coming soon).
  • Ephemeral by design: Create a cluster, run tests, deploy apps, tear it down β€” all in one pipeline run. Zero leftover resources.
  • Multi-tenancy ready: Need 5 isolated environments? Spin up 5 virtual clusters on the same Docker host without multiplying resource usage.
  • Production-like: Despite being lightweight, VIND provides a fully conformant Kubernetes API β€” your manifests, Helm charts, and kubectl commands work exactly as they would on a real cluster.

πŸ–₯️ How to Install VIND on Your System

Prerequisites

  • Docker must be installed and running on your machine.

Step 1: Install the vCluster CLI

macOS:

brew install loft-sh/tap/vcluster

Linux:

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 && \
rm -f vcluster

Windows: Download the latest binary from vCluster Releases and add it to your PATH.

Step 2: Configure vCluster to Use the Docker Driver (VIND Mode)

vcluster use driver docker

This tells vCluster to use Docker as the backend β€” which is what makes it VIND.

Step 3: Create a Kubernetes Cluster

sudo vcluster create test-cluster

That's it! You now have a fully functional Kubernetes cluster running inside Docker. Verify with:

kubectl get nodes
vcluster ls

(Optional) Create a Multi-Node Cluster

Step 1: Create a values.yaml file with your node configuration:

experimental:
  docker:
    nodes:
    - name: "worker-1"
      ports:
        - "9090:9090"
    - name: "worker-2"
      volumes:
        - "/tmp/data:/data"
      env:
        - "NODE_ROLE=worker"

Step 2: If using volumes, make sure the mount path exists:

mkdir -p /tmp/data

Step 3: Create the multi-node cluster:

sudo vcluster create multi-node-cluster --values values.yaml

Useful vCluster Commands

Command Description
vcluster ls List all virtual clusters
vcluster connect <name> Connect to a virtual cluster
vcluster disconnect Disconnect from a virtual cluster
vcluster delete <name> Delete a virtual cluster
vcluster use driver docker Switch to Docker driver (VIND)

For more details, refer to the official VIND documentation: https://github.com/loft-sh/vind


🎬 About This Repository

This project demonstrates a real-world use case of VIND β€” deploying a fully functional static website called CineVerse to a virtual Kubernetes cluster, entirely within a GitHub Actions CI/CD pipeline.

What's Inside

β”œβ”€β”€ index.html              # CineVerse website β€” curated movies & series
β”œβ”€β”€ styles.css              # Dark-themed responsive stylesheet
β”œβ”€β”€ Dockerfile              # nginx:alpine container serving static files
β”œβ”€β”€ k8s/
β”‚   β”œβ”€β”€ deployment.yaml     # Kubernetes Deployment manifest
β”‚   └── service.yaml        # Kubernetes Service manifest
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       └── deploy.yaml     # Full CI/CD pipeline using VIND
β”œβ”€β”€ .dockerignore
└── README.md

The Website β€” CineVerse

A beautiful, responsive, Netflix-style static movie website featuring:

  • Trending section with the latest blockbusters
  • Top Rated Movies β€” Shawshank Redemption, The Godfather, Interstellar, and more
  • Top Rated Series β€” Breaking Bad, Game of Thrones, Stranger Things, and more
  • Genre browser, newsletter signup, and a polished dark theme
  • All poster images sourced from TMDB

βš™οΈ GitHub Actions Workflow β€” How It Works

The pipeline (.github/workflows/deploy.yaml) runs on every push or pull request to main. Here's what it does, step by step:

1️⃣ Build & Push Container Image

Checkout code β†’ Build Docker image (nginx:alpine + static files) β†’ Push to GHCR

The image is tagged with the short commit SHA and pushed to GitHub Container Registry (ghcr.io).

2️⃣ Create a VIND Cluster

Install vcluster CLI β†’ Load kernel modules (overlay, bridge, br_netfilter) β†’ vcluster create demo

This is the core step β€” VIND spins up a virtual Kubernetes cluster called demo right inside the GitHub Actions runner. The vcluster use driver docker command tells vCluster to use the Docker driver (VIND mode). Within ~30 seconds, you have a fully working kubectl-ready cluster.

3️⃣ Deploy the Application

Create GHCR pull secret β†’ sed-inject image tag into manifest β†’ kubectl apply β†’ Wait for rollout

The deployment manifest uses IMAGE_PLACEHOLDER which gets replaced with the actual GHCR image path at runtime. Kubernetes pulls the image, starts the pod, and the site is live inside the cluster.

4️⃣ Expose via ngrok

Port-forward svc β†’ Start ngrok tunnel β†’ Print public URL β†’ Keep alive for 10 minutes

Since the cluster runs inside CI, we use ngrok to create a temporary public tunnel. The workflow prints the live URL so you can open it in your browser and see the deployed website.

5️⃣ Cleanup

vcluster delete demo --force

The virtual cluster is destroyed at the end β€” leaving zero footprint on the runner.

Pipeline Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Checkout │───▢│ Build & Push │───▢│ Create VIND      │───▢│ Deploy to  │───▢│ Expose    β”‚
β”‚   Code   β”‚    β”‚ Docker Image β”‚    β”‚ Cluster (demo)   β”‚    β”‚ Kubernetes β”‚    β”‚ via ngrok β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                                                    β”‚
                                                                              β”Œβ”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”
                                                                              β”‚  Cleanup   β”‚
                                                                              β”‚  (always)  β”‚
                                                                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ”‘ Secrets Setup

The pipeline needs one secret to be configured manually. GITHUB_TOKEN is already provided automatically by GitHub Actions β€” you don't need to do anything for it.

Secret Required Action Purpose
GITHUB_TOKEN None β€” auto-provided Used for GHCR login and image pull secrets. GitHub injects this automatically into every workflow run.
NGROK_AUTH_TOKEN Manual setup required Your ngrok auth token, needed to create the public tunnel to access the deployed site.

How to Get and Add NGROK_AUTH_TOKEN (Step by Step)

  1. Go to https://ngrok.com and sign up for a free account (or log in if you already have one).
  2. After logging in, go to Your Authtoken page: https://dashboard.ngrok.com/get-started/your-authtoken.
  3. Click Copy to copy your auth token.
  4. Now go to your GitHub repository β†’ click Settings (top tab).
  5. In the left sidebar, expand Secrets and variables β†’ click Actions.
  6. Click the "New repository secret" button.
  7. Set the Name to: NGROK_AUTH_TOKEN
  8. Paste the auth token you copied from ngrok into the Secret field.
  9. Click "Add secret".

That's it! The secret is now available to your workflow.


πŸƒ How to Run

  1. Fork or clone this repository.
  2. Set up the NGROK_AUTH_TOKEN secret following the steps above.
  3. Push to main or open a Pull Request β€” the pipeline triggers automatically.
  4. Go to the Actions tab, open the running workflow, and wait for it to complete.
  5. Open the "🎬 Show public URL" step in the workflow logs.
  6. Click the ngrok URL β€” your CineVerse website is live!

πŸ“Έ What You'll See

Once the pipeline completes, the workflow logs will show something like:

============================================
  🎬  YOUR WEBSITE IS LIVE!  🎬
============================================
  🌐  https://xxxx-xx-xxx-xxx-xx.ngrok-free.app
============================================
  Tunnel will stay open for ~10 minutes
============================================

Open the URL and you'll see the fully deployed CineVerse website running on a Kubernetes cluster that was created from scratch β€” all in under 5 minutes.


πŸ› οΈ Tech Stack

  • Website: HTML5 + CSS3 (static, no frameworks)
  • Container: nginx:alpine
  • Orchestration: Kubernetes via VIND (vCluster Docker driver)
  • Registry: GitHub Container Registry (GHCR)
  • CI/CD: GitHub Actions
  • Tunnel: ngrok v3
  • Images: TMDB API (poster images)

οΏ½ Result Screenshots

GitHub Actions Pipeline

GitHub Actions Pipeline

GitHub Actions Pipeline β€” VIND Cluster Logs

GitHub Actions Pipeline with VIND Logs

Deployed CineVerse Website

Static Website

Static Website Continued


οΏ½πŸ“ License

This project is for educational and demonstration purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors