Containers & Kubernetes
Kubernetes is the de-facto container orchestration platform. Understanding it deeply is essential for any platform or DevSecOps engineer operating modern infrastructure.
Prerequisites
Section titled “Prerequisites”- Comfort with Linux command line (Essential Commands)
- Basic understanding of containers (Docker run, images, volumes)
Architecture overview
Section titled “Architecture overview”Control Plane Worker Nodes┌────────────────────────┐ ┌──────────────────┐│ kube-apiserver │◄──────────►│ kubelet ││ etcd │ │ kube-proxy ││ kube-controller-mgr │ │ container runtime││ kube-scheduler │ │ Pods │└────────────────────────┘ └──────────────────┘- kube-apiserver — the front door; everything talks to this
- etcd — distributed key-value store; the source of truth for cluster state
- kube-scheduler — assigns pods to nodes based on resource requirements and constraints
- kube-controller-manager — reconciliation loops (ReplicaSet, Deployment, Node controllers)
- kubelet — agent on each node; ensures containers in pods are running
- kube-proxy — manages iptables/ipvs rules for Service networking
Core resources
Section titled “Core resources”| Resource | What it does |
|---|---|
| Pod | Smallest deployable unit — one or more containers sharing network and storage |
| Deployment | Manages replicated Pods with rolling updates and rollback |
| StatefulSet | Like Deployment, but for stateful workloads — stable pod names and persistent storage |
| DaemonSet | Runs one pod per node — used for logging, monitoring agents |
| Service | Stable network endpoint for a set of Pods |
| Ingress | HTTP/HTTPS routing from outside the cluster to Services |
| ConfigMap / Secret | Inject configuration and credentials into Pods |
| Namespace | Virtual cluster — isolate resources, apply RBAC and quotas |
Essential kubectl commands
Section titled “Essential kubectl commands”# Context managementkubectl config get-contextskubectl config use-context prod
# Pod operationskubectl get pods -n defaultkubectl get pods -A # all namespaceskubectl describe pod my-podkubectl logs my-pod -f # follow logskubectl exec -it my-pod -- /bin/sh # shell into pod
# Apply manifestskubectl apply -f deployment.yamlkubectl delete -f deployment.yaml
# Rolloutkubectl rollout status deployment/appkubectl rollout undo deployment/app # rollbackWhere to go next
Section titled “Where to go next”Kubernetes Security Hardening — CIS benchmarks, network policies, admission control