Kubernetes (aka K8s) is an open-source container orchestration platform that automates deployment, scaling, and management of containerized applications. In short:
Kubernetes runs your containers reliably, at scale, and without manual babysitting.
What Kubernetes Does
| Problem | Kubernetes Solution |
|---|---|
| Deploying many containers | Declarative YAML + Controllers |
| Scaling containers on demand | Autoscaling |
| Handling container failures | Self-healing (restarts, rescheduling) |
| Managing service discovery | DNS-based internal discovery |
| Load balancing traffic | Built-in Services & Ingress |
| Rolling out updates safely | Rolling updates, canary deploys |
| Managing multi-host clusters | Schedules containers on nodes |
Core Components
1. Pod
- The smallest deployable unit.
- One or more containers with shared resources (network, storage).
- Typically runs one container per pod in practice.
2. Node
- A physical or virtual machine in the cluster.
- Runs container runtime (Docker, containerd) and Kubelet.
3. Cluster
- A group of nodes managed by Kubernetes.
4. Deployment
- Describes desired state (e.g., 3 replicas of app:v2) in YAML.
- Kubernetes ensures that actual state matches desired state.
5. Service
- Stable network identity (DNS + port) for a group of pods.
- Handles load balancing across pod replicas.
6. Ingress
- Exposes HTTP(S) routes from outside the cluster to services.
- Supports routing rules, TLS, etc.
7. ConfigMap & Secret
- Externalize configuration (ConfigMaps for plain data, Secrets for sensitive data).
8. Volume
- Persistent storage (can be disk, cloud storage, NFS, etc.).
Key Concepts
Declarative Model
You tell K8s what you want in YAML (e.g., “3 replicas”), and it figures out how to make it happen.
Control Loop
Kubernetes controllers constantly compare the actual state with the desired state and reconcile differences.
Labels & Selectors
Tag and filter resources for grouping, service discovery , etc.
Popular Use Cases
- Deploying microservices
- Rolling out canary/blue-green deployments
- Auto-scaling based on CPU/memory
- Zero-downtime upgrades
- Hybrid cloud or multi-cloud deployments
Dev Workflow Example
1. Write YAML files for:
- Deployment: how many replicas
- Service: internal networking
- Ingress: external exposure
2. Run kubectl apply -f deployment.yaml
3. Kubernetes:
- Schedules pods on nodes
- Exposes them via services
- Monitors health, restarts failed pods
- Scales up/down as needed
Things to watch out for
| Challenge | Solution / Tool |
|---|---|
| YAML fatigue | Helm, Kustomize |
| Debugging | kubectl logs, kubectl describe |
| Cluster cost/complexity | Start with managed K8s (EKS, GKE, AKS) |
| Network management | Use CNI plugins (Calico, Flannel) |
| Persistent storage | Use StatefulSets, PVCs |
| Secrets management | Use external tools (Vault, SOPS) |
Ecosystem Add-ons
| Need | Tool |
|---|---|
| Packaging | Helm |
| GitOps | ArgoCD, Flux |
| Observability | Prometheus + Grafana |
| Security Scanning | Trivy, Kube-bench |
| CI/CD | Tekton, Jenkins, GitHub Actions |
| Service Mesh | Istio, Linkerd |
Mental Model
“Kubernetes is like an operating system for the cloud. Instead of managing apps on a single server, you tell Kubernetes what to run — and it figures out where and how to run it.”