You will create a local Kubernetes cluster, learn the core kubectl workflow, and run your first deployment. By the end you will understand how the control plane keeps your desired state running.

Learning Objectives

  • Spin up a local cluster with kind or minikube.
  • Use kubectl to create and inspect workloads.
  • Run a self-healing deployment.
  • Time: ~3 hours · Difficulty: Intermediate · Prereqs: Docker and kubectl installed.

Architecture Overview

Environment Setup

You will need: Docker, kubectl, and kind (or minikube).

Before you begin: confirm kubectl is installed with kubectl version --client.

Step-by-Step Execution

01
Create a local cluster
kind create cluster --name lab
Boots a single-node Kubernetes cluster in Docker.
02
Run a deployment

A Deployment declares desired replicas; the controller keeps that many pods running.

kubectl create deployment web --image=nginx:stable --replicas=2
03
Inspect the cluster
$ kubectl get pods -o wide
NAME READY STATUS NODE web-6f...-a1b2 1/1 Running lab-control-plane web-6f...-c3d4 1/1 Running lab-control-plane

Progress So Far

Testing & Validation

kubectl delete pod -l app=web --field-selector status.phase=Running --grace-period=0 | head -1; kubectl get deploy web

After deleting a pod, the deployment should report the desired replica count again within seconds, proving self-healing.

Troubleshooting
  • kubectl cannot connect: kind writes a kubeconfig context; confirm with kubectl config current-context.
  • Pods Pending: the node may lack resources; check kubectl describe pod.
  • ImagePullBackOff: the image name or tag is wrong; verify it pulls with docker.

Extension Ideas

Key Results

  • Created a working local Kubernetes cluster.
  • Ran a 2-replica deployment via kubectl.
  • Observed control-plane reconciliation of desired state.
  • Proved self-healing by deleting and recovering a pod.