Computers & Electronics
162,915 views
28 min · 3 min read
8 steps
Advanced

How to set up a basic Kubernetes cluster locally for learning and development

Setting up a local Kubernetes cluster is a great way to learn container orchestration and test cloud-native ideas without spending money. This guide walks you through a simple, repeatable setup suitable for development and experimenting with pods, services, and deployments. Expect to spend about 30–90 minutes depending on downloads and familiarity. I'll focus on lightweight tools so you can run everything on a typical laptop with 8 GB RAM.

Verified by pleasexplain editors
  1. Step 1: Confirm system requirements

    Check that your machine has at least 8 GB of RAM, 20 GB of free disk space, and a 64-bit CPU. Verify OS compatibility: recent Linux, macOS (10.14+), or Windows 10/11 with WSL2. Ensuring these resources prevents subtle failures when starting the cluster.

    [Illustration: laptop system info screen showing RAM and disk usage bars]

  2. Step 2: Install container runtime

    Install Docker Desktop (macOS/Windows) or containerd/Docker Engine (Linux) and start the service. Verify with docker version or ctr version; expect startup within 1–3 minutes. A working container runtime is required because Kubernetes schedules containers using that runtime.

    [Illustration: desktop screen showing Docker whale icon and terminal with docker version]

  3. Step 3: Choose a local Kubernetes tool

    Pick a simple tool like Kind or Minikube for single-node clusters; choose Kind if you already have Docker, or Minikube if you prefer a VM. Install with a package manager (e.g., brew install kind or curl + install minikube) and confirm with kind --version or minikube version. These tools create an easy, disposable cluster for development.

    [Illustration: terminal showing kind create cluster or minikube start command]

  4. Step 4: Create the cluster

    Run kind create cluster --name dev --wait 60s or minikube start --cpus=2 --memory=4096 --driver=docker and wait 30–90 seconds for setup. Use --wait or check status until ready. This step provisions a single-node control plane and worker so you can deploy workloads locally without cloud resources.

    [Illustration: terminal showing cluster creation progress with READY status]

  5. Step 5: Configure kubectl access

    Install kubectl matching your Kubernetes version and ensure it points to the new cluster with kubectl config current-context. Test with kubectl get nodes and kubectl get pods -A; both should return the local node and system pods. Proper kubectl configuration is how you control and inspect the cluster.

    [Illustration: terminal showing kubectl get nodes output with one Ready node]

  6. Step 6: Deploy a sample app

    Apply a simple manifest, for example kubectl apply -f deployment.yaml that creates a 2-replica nginx Deployment and a Service type=NodePort. Wait 10–30 seconds and check with kubectl get deploy, pods, and svc. This validates scheduling, networking, and service discovery in your cluster.

    [Illustration: terminal showing kubectl apply and pods becoming Running with nginx image]

  7. Step 7: Explore dashboards and tools

    Install optional tools: kubectl port-forward or minikube dashboard for a web UI, and lens or k9s for a richer local view. Forward a service with kubectl port-forward svc/nginx 8080:80 and open http://localhost:8080 to confirm traffic. Observability tools help you learn how resources interact in real time.

    [Illustration: browser window showing Kubernetes dashboard and a local nginx page]

  8. Step 8: Tear down or reset cluster

    When done, delete the cluster to free resources: kind delete cluster --name dev or minikube delete. If experimenting, recreate in 1–2 minutes to return to a clean state. Regularly recreating the cluster avoids configuration drift and keeps experiments reproducible.

    [Illustration: terminal showing kind delete cluster confirming resources removed]


  • Allocate at least 4 GB RAM if you plan to run multiple pods; 8 GB is safer for simultaneous tools.
  • Pin tool versions (kubectl, kind, minikube) to avoid incompatibilities; note versions in a text file.
  • Use Docker image caches or a local registry mirror to reduce repeated download time; saves minutes per image pull.
  • Keep manifests simple and declarative (YAML files) so you can version-control and replay experiments.
  • Enable RBAC but use a single admin context for local development to reduce permission friction.
  • Use minikube or kind snapshots or export kubeconfigs to share cluster state with teammates quickly.

  • Don't run production workloads on a local single-node cluster; it lacks high availability and security hardening.
  • Avoid exposing cluster control-plane ports to untrusted networks; local dashboards can be sensitive.
  • Be careful with Docker Desktop resource settings — allocating too little or too much memory can slow your machine or fail workloads.
  • Deleting the cluster removes all state; back up persistent data before running kind delete or minikube delete.

Was this guide helpful?