Containers and orchestration
Kubernetes core concepts
The control loop at the heart of Kubernetes, the objects you use every day, and how a request reaches a pod. Start here for the map of Kubernetes pages.
Kubernetes keeps a cluster of machines running the containers you declared. You do not say "start three processes on node 7." You say "I want three replicas of this pod, always," and controllers keep working until the cluster matches that wish. That idea, desired state plus continuous reconciliation, is the core of the system. Everything else is vocabulary on top of it.
If you do not know containers yet, start with containers. A pod is one or more containers that share a network address and volumes, running on one node.
Read in order
| Step | Concept | What it answers |
|---|---|---|
| 1 | The control plane and the reconciliation loop | What runs the cluster, and how does it keep things running? |
| 2 | Pods and workload objects | Which object should run my app: a Deployment, StatefulSet, DaemonSet or Job? |
| 3 | Services and DNS | How does a client reach a pod whose IP keeps changing? |
| 4 | Config, storage and labels | Where do settings, secrets, disks and names live? |
| 5 | Debugging CrashLoopBackOff | A pod keeps crashing. What do you check, in what order? |
Common mistakes across the topic
- Treating pods as permanent. Pods are ephemeral. If a node dies, the pod is gone and a controller makes a new one with a new IP.
- Running naked pods in production. Nothing recreates a pod that has no controller.
- Assuming NetworkPolicy works. Without a CNI plugin that supports it, NetworkPolicy objects do nothing and raise no error.
- Treating Secrets as encrypted. By default they are only base64 in etcd.
Managed or self-managed
For almost every product company, use a managed control plane (EKS, GKE or AKS). The provider runs the control plane, patches it and backs up etcd. Your team owns node pools, networking, add-ons and workload YAML. Build your own control plane only if a platform team's full-time job is running it.
Key takeaways
- Kubernetes compares desired state in the API with what is running, and acts to close the gap.
- Pods are ephemeral. Deployments keep replicas. StatefulSets, DaemonSets and Jobs cover sticky identity, per-node agents and batch work.
- Services give stable names and virtual IPs. Readiness decides who gets traffic.
- Debug with
describe,logs --previousand events before you guess. - Use a managed control plane, and spend your effort on workloads and automation.
Further learning
The official concepts docs are the reference for every object on this page.
Kubernetes concepts (official docs)The Concepts section helps you learn about the parts of the Kubernetes system and the abstractions Kubernetes uses to represent your cluster, and helps you obtain a deeper understanding of how Kubernetes works.Kubernetes
Carson Anderson's "Kubernetes Deconstructed" peels the cluster from end-user objects down to controllers, scheduling and networking. It is the best single talk for the mental model above.
Related
Containers from the inside
Namespaces, cgroups and layered images - what a container really is, how images are built and shipped, and how to write small, fast, secure Dockerfiles.
Kubernetes in production
Requests and limits, probes, autoscaling, disruption budgets, packaging and the mistakes that cause outages.
Consensus and Raft
How a cluster agrees on one value or one log despite crashes and partitions, how Raft works, and where etcd, ZooKeeper and consensus-backed databases fit.