About the Kubernetes YAML Cheat Sheet
Kubernetes manifests are verbose, and most of the verbosity is boilerplate you copy rather than think about. The parts worth understanding are the few fields that change behaviour meaningfully: selectors and labels, resource requests and limits, probes, and the security context.
Selectors are where manifests most often go quietly wrong. A Service finds pods by label, not by name or by Deployment — a mismatch produces a Service with no endpoints and no error anywhere. A Deployment's selector is immutable after creation, so getting it wrong means recreating the Deployment.
Requests and limits are the other high-consequence field. Requests drive scheduling and are what the autoscaler reasons about; limits cause throttling for CPU and termination for memory. Setting a memory limit far above the request is how pods get OOM-killed on a node that looked like it had room.
Frequently asked questions
My Service has no endpoints. What is wrong?
The Service's selector does not match any running pod's labels, or the matching pods are not ready. Compare the Service selector against the pod labels rather than the Deployment's, since the pod template is what produces them. If labels match, check readiness probes — a pod that is not ready is deliberately excluded from endpoints.
What is the difference between requests and limits?
Requests are what the scheduler reserves and what determines which node a pod lands on. Limits are the ceiling enforced at runtime. Exceeding a CPU limit throttles the process; exceeding a memory limit terminates it. Setting requests too low leads to nodes that look free and are not, which is the usual cause of mysterious evictions.
When should I use a liveness probe versus a readiness probe?
Readiness controls traffic — a failing readiness probe removes the pod from Service endpoints without restarting it. Liveness controls restarts — a failing liveness probe kills the container. An aggressive liveness probe on a slow-starting application creates a restart loop, which is why startup probes exist to cover initialisation separately.
Why did my Deployment update not roll out?
Only changes to the pod template trigger a rollout. Editing a ConfigMap or Secret the pods mount changes nothing about the template, so nothing restarts and the old configuration stays live. Either roll out the Deployment explicitly, or include a hash of the configuration in a pod annotation so a change alters the template.
What belongs in a ConfigMap versus a Secret?
Non-sensitive configuration in a ConfigMap, sensitive values in a Secret. Be aware that Secrets are base64-encoded rather than encrypted by default, so enable encryption at rest and restrict RBAC accordingly. Anyone who can create a pod in a namespace can usually read that namespace's secrets, which is worth remembering when deciding what to store there.