Skip to main content

Setting Up Your Lab (Local Cluster)

Key Takeaways for AI & Readers
  • Local Learning Labs: Tools like Kind, Minikube, and K3d allow you to run Kubernetes locally without cloud costs.
  • Kind (Recommended): Best for speed and multi-node simulations using Docker containers as nodes.
  • kubectl CLI: The primary tool for interacting with your cluster, requiring a valid ~/.kube/config to function.

You don't need a cloud account (AWS/GCP) to learn Kubernetes. You can run a production-grade cluster directly on your laptop using containers or virtual machines.

Choose your tool below. We recommend Kind for most users.

Kubernetes in Docker (Kind)

Kind is a tool for running local Kubernetes clusters using Docker container "nodes".

Why use it?

  • Fast: Spins up in seconds.
  • Multi-Node: Can simulate a 3-node cluster easily.
  • Lightweight: Uses Docker containers, not heavy VMs.

Installation

# MacOS
brew install kind

# Windows
choco install kind

# Linux
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
chmod +x ./kind
mv ./kind /usr/local/bin/kind

Basic Usage

# Create a cluster
kind create cluster --name k8s-playground

# Verify it's running
kubectl cluster-info

# Delete the cluster
kind delete cluster --name k8s-playground

Advanced: Multi-Node Configuration

Create kind-config.yaml:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker

Run: kind create cluster --config kind-config.yaml


Accessing the Cluster: kubectl

Once your cluster is running, you need the CLI.

Installation

# MacOS
brew install kubectl

# Linux
snap install kubectl --classic

# Windows
choco install kubernetes-cli

Configuration

kubectl looks for ~/.kube/config.

Pro Tools

  • Aliases: Add alias k=kubectl.
  • kubectx: Switch clusters fast.
brew install kubectx