Intro
Kubernetes is the orchestration platform for containerised apps. Declarative state, automatic scheduling, self-healing, rolling updates.
Kubernetes — what it is
EXAMPLE
# ===== The model =====
# You describe DESIRED state in YAML (Deployment, Service, etc).
# The control plane reconciles ACTUAL state to match.
# Pod dies -> controller replaces. Node dies -> pods reschedule.
# ===== Core objects =====
# Pod smallest deployable unit (usually one container)
# Deployment manages identical Pods (replicas, rolling updates)
# Service stable network endpoint in front of pods
# Ingress HTTP/HTTPS routing into the cluster
# ConfigMap non-secret config
# Secret sensitive config
# Namespace logical grouping
# Job / CronJob one-shot / scheduled tasks
# StatefulSet pods with stable identity + persistent volumes
# DaemonSet one pod per node (log shippers, agents)
# ===== Tiny example =====
apiVersion: apps/v1
kind: Deployment
metadata: { name: shop }
spec:
replicas: 3
selector: { matchLabels: { app: shop } }
template:
metadata: { labels: { app: shop } }
spec:
containers:
- name: shop
image: ghcr.io/me/shop:v1
ports: [{ containerPort: 3000 }]
readinessProbe: { httpGet: { path: /healthz, port: 3000 } }
---
apiVersion: v1
kind: Service
metadata: { name: shop }
spec:
selector: { app: shop }
ports: [{ port: 80, targetPort: 3000 }]
# Apply:
kubectl apply -f shop.yaml
kubectl get pods,svc -l app=shop
# ===== Daily commands =====
kubectl get pods -A
kubectl logs -f <pod>
kubectl describe pod <pod>
kubectl exec -it <pod> -- sh
kubectl rollout status deploy/shop
kubectl port-forward svc/shop 8080:80
# ===== Where K8s lives =====
# Managed: EKS (AWS), GKE (Google), AKS (Azure), DOKS, Linode LKE
# Self-host: kubeadm, kops, k3s, rke2
# Local dev: kind, k3d, minikube, Docker Desktop
# ===== When K8s wins =====
# - 5+ services that need to talk
# - Multi-team or multi-tenant platforms
# - Rolling deploys + autoscaling + self-healing
# - Hybrid / multi-cloud portability
# ===== When K8s hurts =====
# - One container, one box, one user (use a PaaS)
# - Tiny team without ops capacity
# - GPU / specialised hardware (manageable but extra)
# ===== Patterns to internalise =====
# - Declarative everything; YAML in git; apply via CI
# - Probes (liveness, readiness, startup) on every container
# - Requests + limits on every container
# - Namespaces per environment; RBAC by namespace
# ===== Pitfalls =====
# - 'latest' image tags -> non-deterministic deploys
# - No resource limits -> noisy neighbour crashes others
# - Secrets in plain ConfigMaps
# - kubectl apply by hand on prod -> drift from git source of truth
Why it matters
Kubernetes is a control plane: you write YAML for the state you want, the controllers do the work. Describe, do not script. Reach for it when many services need to be deployed, scaled, and healed without manual touch — and let a managed offering carry the operational weight.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Example
Example
# Kubernetes (K8s) orchestrates containers. # Schedules, scales, heals, networks them.Try it Yourself »
Exercise
Short name for Kubernetes.
Three characters.
Discussion
Loading…