Local Setup (kind / minikube)
Installing kubectl, picking a local cluster (kind, minikube, k3d, Docker Desktop), and verifying the wiring end-to-end.
Kubernetes — install + verify
EXAMPLE
# ===== 1. kubectl =====
# macOS:
brew install kubectl
# Linux:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -m 0755 kubectl /usr/local/bin/kubectl
# Windows (winget):
winget install --id Kubernetes.kubectl -e
# Verify:
kubectl version --client --output=yaml
# ===== 2. Pick a local cluster =====
# kind (Kubernetes in Docker) -- light, fast, multi-node
# Install: brew install kind | go install sigs.k8s.io/kind@latest
kind create cluster --name dev
# minikube -- single-node, addons (ingress, dashboard, metrics-server)
brew install minikube
minikube start --driver=docker --cpus=4 --memory=6g
# k3d (k3s in Docker) -- very small, multi-node-ish
brew install k3d
k3d cluster create dev --servers 1 --agents 2
# Docker Desktop -- bundled. Enable in Settings -> Kubernetes -> Enable.
# Easiest, but slower to start and harder to inspect.
# ===== 3. Verify =====
kubectl cluster-info
kubectl get nodes -o wide
# NAME STATUS ROLES AGE VERSION
# dev-control-plane Ready control-plane 1m v1.30.3
# Run a smoke pod:
kubectl run hello --image=ghcr.io/oci/hello-world:latest --restart=Never
kubectl wait --for=condition=ready pod/hello --timeout=60s
kubectl logs hello
kubectl delete pod hello
# ===== 4. The kubeconfig =====
# Default: ~/.kube/config
# Each kind/k3d/minikube cluster writes a context here.
kubectl config get-contexts
kubectl config use-context kind-dev
kubectl config current-context
# Switch shortcut:
kubectl config use-context minikube
# ===== 5. Quality-of-life tools =====
# kubectx + kubens -- fast context/namespace switching
brew install kubectx
kubectx # list / pick a context
kubens # list / pick a namespace
# k9s -- terminal UI dashboard
brew install k9s
k9s
# stern -- multi-pod log tailing
brew install stern
stern -n default '.*'
# ===== 6. Test deploy =====
cat <<'YAML' | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 2
selector: { matchLabels: { app: nginx } }
template:
metadata: { labels: { app: nginx } }
spec:
containers:
- name: nginx
image: nginx:1.27-alpine
ports: [{ containerPort: 80 }]
---
apiVersion: v1
kind: Service
metadata: { name: nginx }
spec:
selector: { app: nginx }
ports: [{ port: 80 }]
type: ClusterIP
YAML
kubectl get deploy,svc -l app=nginx
kubectl port-forward svc/nginx 8080:80
# Visit http://localhost:8080
kubectl delete deploy nginx svc nginx
# ===== Patterns to internalise =====
# - kubectl + kind is the smallest working environment; reach for it before EKS/GKE
# - Treat kubeconfig contexts seriously; one prod context lives in a different file or vault
# - kubectx/kubens/k9s save real time once you do this 5+ times a day
# - Run a smoke deploy after install; do not trust 'kubectl version' alone
# ===== Pitfalls =====
# - 'I have multiple kubeconfigs and now everything is the wrong context' -> KUBECONFIG=~/.kube/dev.yaml
# - Using minikube on Apple Silicon without --driver=docker -> arch mismatch
# - Forgetting --restart=Never on kubectl run -> creates a Deployment for a one-shot
# - Dashboard exposed without auth on a shared machine
Why it matters
Install the client, pick a local cluster (kind or k3d for speed), and verify with a smoke deploy. The kubeconfig contexts, kubectx/kubens, and k9s pay for themselves the first day. Build the muscle on local; the cloud cluster only adds IAM, not new mental model.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Example
Example
# Local: kind / minikube / k3d / Docker Desktop. # Managed: EKS / GKE / AKS. kind create clusterTry it Yourself »
Discussion
Loading…