π Building a Free CI/CD Pipeline for Node.js with Kubernetes (Minikube + GitHub Actions)


π‘ Why This Project?
When learning DevOps, most tutorials directly jump to AWS EKS, GKE, or AKS. While these are powerful, theyβre also paid services. For someone practicing at home, thatβs not ideal.
Thatβs why I built this pipeline with Minikube (local Kubernetes) and a self-hosted GitHub Actions runner. This way:
CI/CD feels real-world (GitHub Actions + Docker Hub + Kubernetes).
I didnβt have to spend on cloud bills (EKS costs money for clusters + nodes).
The entire setup runs inside a single VM on my laptop.
In short: itβs a budget-friendly, yet production-like DevOps workflow.
π What This Project Does
This project demonstrates a complete DevOps CI/CD pipeline for a Node.js application:
Develop a simple Node.js app.
Containerize it with Docker.
Push the image to Docker Hub via GitHub Actions (CI).
Deploy it to Kubernetes (Minikube) via GitHub Actions (CD).
Access the app via a Kubernetes Service.
Because Minikube runs locally, I used a self-hosted runner inside the VM so GitHub Actions can talk to the cluster.
π§± Prerequisites
A Linux VM (Ubuntu is perfect) β I used VirtualBox.
Docker, kubectl, Minikube installed.
Node.js 16+ (for testing locally).
A Docker Hub account.
A GitHub repository.
π Project Structure
.
βββ .github/workflows/ci-cd.yml
βββ Dockerfile
βββ k8s/
β βββ deployment.yaml
β βββ service.yaml
βββ app/
β βββ index.js
β βββ server.js
β βββ package.json
βββ README.md
βοΈ Step 1 β Set Up Project Locally
mkdir -p ~/projects && cd ~/projects
git clone https://github.com/<your-gh-username>/nodejs-k8s-cicd.git
cd nodejs-k8s-cicd
ls -la
βοΈ Step 2 β Configure Minikube
Start Minikube:
minikube start --driver=docker
Check cluster:
kubectl config current-context # should be "minikube"
kubectl cluster-info
kubectl get nodes
βοΈ Step 3 β Setup Docker Hub & Secrets
In GitHub β Settings β Secrets and variables β Actions:
DOCKERHUB_USERNAME
β your usernameDOCKERHUB_TOKEN
β Docker Hub access token
βοΈ Step 4 β GitHub Actions Workflow
CI/CD workflow lives at .github/workflows/ci-cd.yml
:
Build job: Runs on GitHubβs free
ubuntu-latest
runner.Deploy job: Runs on your self-hosted runner in the VM (so it can talk to Minikube).
βοΈ Step 5 β Self-Hosted Runner
Since Minikube is local, deployment must also happen local.
Steps:
cd ~
mkdir actions-runner && cd actions-runner
# download runner
curl -o actions-runner-linux-x64.tar.gz -L https://github.com/actions/runner/releases/download/vX.Y.Z/actions-runner-linux-x64-X.Y.Z.tar.gz
tar xzf actions-runner-linux-x64.tar.gz
# configure with repo + token
./config.sh --url https://github.com/<your-gh-username>/nodejs-k8s-cicd --token <YOUR_TOKEN>
# run (foreground)
./run.sh
(Optional: install as service so it persists after reboot).
βοΈ Step 6 β Trigger Pipeline
echo "// test change" >> app.js
git add app.js
git commit -m "Trigger pipeline"
git push
Build job β builds & pushes Docker image to Docker Hub.
Deploy job β applies Kubernetes manifests.
Check app status:
kubectl get pods
kubectl get svc
minikube service nodejs-service --url
Open the printed URL in browser π
π Why Minikube + Self-Hosted Runner, Not AWS EKS?
I deliberately avoided EKS because:
Cost β EKS control plane + nodes = $$$ even for small clusters.
Simplicity β Minikube runs everything in a single VM.
Learning Focus β My goal was to practice Kubernetes CI/CD, not manage AWS networking & billing.
Self-Hosted Runner β Keeps everything free, but still shows how CD pipelines work with Kubernetes.
Once this works on Minikube, migrating to EKS later is straightforward β manifests and workflow logic stay the same, only cluster context changes.
Subscribe to my newsletter
Read articles from HARSHAL VERNEKAR directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

HARSHAL VERNEKAR
HARSHAL VERNEKAR
π Aspiring DevOps & Cloud Engineer with a strong foundation in cloud platforms (AWS), infrastructure automation, and container orchestration tools like Docker and Kubernetes. Iβm passionate about building reliable, scalable, and secure cloud-native applications. π§ Currently building real-world projects using Terraform, Ansible, Jenkins, GitHub Actions, and EKS to understand how modern infrastructure is deployed, managed, and monitored. I enjoy breaking things (safely), debugging, and learning from hands-on experience. π¦ Comfortable working with: AWS (EC2, S3, IAM, VPC, EKS) Docker, Kubernetes (Minikube & EKS) CI/CD tools like Jenkins & GitHub Actions IaC tools like Terraform & Ansible Monitoring with Prometheus & Grafana Linux, Bash, Git, and Networking fundamentals π‘ Always learning β currently exploring deeper concepts in Kubernetes workloads, Helm, and scaling best practices. π Open to DevOps, Cloud, or SRE roles where I can grow, contribute, and solve real-world problems.