Target Audience: Developers who want to practice Kubernetes locally Prerequisites: Docker basics After reading this: You’ll be able to set up a local Kubernetes environment with Minikube or Kind

TL;DR
  • Minikube: Single node, recommended for beginners, rich addon support
  • Kind: Multi-node capable, suitable for CI/CD, fast cluster creation
  • Docker Desktop: Simplest setup for macOS/Windows

Local Kubernetes Options Comparison#

ToolProsConsBest For
MinikubeRich addons, extensive docsSingle node onlyLearning, development
KindFast, multi-node, CI-friendlyFewer addonsCI/CD, testing
Docker DesktopEasy installationHigh resource usageQuick start
k3dLightweight, fastDifferent from productionQuick testing

Minikube Installation#

Install#

# Install via Homebrew
brew install minikube

# Check version
minikube version
# Download binary
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

# Install
sudo install minikube-linux-amd64 /usr/local/bin/minikube

# Check version
minikube version
# Install via Chocolatey
choco install minikube

# Or manual installation
# https://minikube.sigs.k8s.io/docs/start/

Start Cluster#

# Start with default settings
minikube start

# Specify resources
minikube start --cpus=4 --memory=8192

# Use specific Kubernetes version
minikube start --kubernetes-version=v1.29.0

# Specify driver
minikube start --driver=docker

Available drivers:

DriverPlatformFeatures
dockerAllRecommended, most stable
virtualboxAllFull VM, slow
hyperkitmacOSLightweight
hypervWindowsWindows built-in

Check Status#

# Cluster status
minikube status

# Kubernetes version
kubectl version

# Node information
kubectl get nodes

Useful Addons#

# List addons
minikube addons list

# Enable key addons
minikube addons enable metrics-server  # Required for HPA
minikube addons enable ingress         # Ingress testing
minikube addons enable dashboard       # Web UI

Access Dashboard#

# Open Dashboard
minikube dashboard

Cluster Management#

# Pause
minikube pause

# Resume
minikube unpause

# Stop (preserve resources)
minikube stop

# Delete (remove all data)
minikube delete

Kind Installation#

Kind (Kubernetes IN Docker) is a tool that uses Docker containers as nodes.

Install#

brew install kind
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
choco install kind

Create Cluster#

# Basic cluster (single node)
kind create cluster

# Named cluster
kind create cluster --name my-cluster

# Multi-node cluster
cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
EOF

Multi-node Configuration File#

# kind-config.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
  - containerPort: 443
    hostPort: 443
- role: worker
- role: worker
kind create cluster --config=kind-config.yaml

Cluster Management#

# List clusters
kind get clusters

# Delete cluster
kind delete cluster --name my-cluster

# Load image (load local image into cluster)
kind load docker-image my-app:1.0 --name my-cluster

kubectl Installation#

kubectl is the CLI tool for communicating with Kubernetes clusters.

brew install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install kubectl /usr/local/bin/kubectl
choco install kubernetes-cli

kubectl Auto-completion Setup#

# Install bash-completion
# macOS
brew install bash-completion

# Add to .bashrc
echo 'source <(kubectl completion bash)' >> ~/.bashrc
echo 'alias k=kubectl' >> ~/.bashrc
echo 'complete -F __start_kubectl k' >> ~/.bashrc
source ~/.bashrc
# Add to .zshrc
echo 'source <(kubectl completion zsh)' >> ~/.zshrc
echo 'alias k=kubectl' >> ~/.zshrc
source ~/.zshrc

Useful kubectl Aliases#

# Add to ~/.bashrc or ~/.zshrc
alias k='kubectl'
alias kg='kubectl get'
alias kd='kubectl describe'
alias kl='kubectl logs'
alias kx='kubectl exec -it'
alias ka='kubectl apply -f'
alias kdel='kubectl delete'

Installation Verification#

Verify your environment is set up correctly.

# Cluster information
kubectl cluster-info

# Node list
kubectl get nodes

# Check system Pods
kubectl get pods -n kube-system

# Run test Pod
kubectl run test --image=nginx --rm -it --restart=Never -- curl localhost

Expected output:

Kubernetes control plane is running at https://127.0.0.1:xxxxx
CoreDNS is running at https://127.0.0.1:xxxxx/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

Next Steps#

After completing environment setup, proceed to:

GoalRecommended Document
Getting started with KubernetesQuick Start
Practice basic resourcesBasic Example
Deploy real appSpring Boot Deployment