Kubernetes Manifests Cheat Sheet: Deployment, Service, Probes and Resources
Checked against Kubernetes Kubernetes 1.37 docs (latest patch 1.37.2) on 28 November 2026. Each section links to the official docs it was checked against.
This sheet is for developers who write Kubernetes YAML by hand and want the fields, defaults and gotchas in one place. It follows the kubernetes.io documentation for 1.37, the newest minor release (1.37.2 shipped on 13 Oct 2026). Nothing here was applied to a live cluster, so every row is marked as checked in the docs only.
When to use what
Start almost every stateless app with a Deployment, not a bare Pod: the Deployment gives you rolling updates, rollback history and self-healing for free. Put a ClusterIP Service in front of it, because ClusterIP is the default type and keeps the app private to the cluster. Reach for NodePort only for quick experiments, and for LoadBalancer when your cloud provider should hand you an external address.
For HTTP traffic from outside, pick Gateway API for anything new. The Ingress page now says the project recommends Gateway and that the Ingress API is frozen. Ingress still works and isn't being removed, so there is no rush to migrate a stable setup, but new features only land in Gateway API. The Kubernetes YAML generator gives you a starting manifest you can then trim.
On resources, always set memory requests and limits, and be careful with CPU limits. Going over a CPU limit only throttles the container, while going over a memory limit can get it OOM-killed. If units confuse you, paste them into the resource quantity converter before you commit. For probes, add a readiness probe first, since it controls traffic, then a startup probe for slow boots, and only then a liveness probe that checks something the app can't recover from on its own. If you'd like an AI agent to inspect a cluster for you, the Kubernetes MCP server page covers what it can reach.
The selector is immutable after creation, so choose the labels carefully the first time.
apiVersion: apps/v1
kind: DeploymentHeader for a Deployment manifest; Deployments live in the apps/v1 API group.
spec.selector.matchLabelsMust match spec.template.metadata.labels, or the API server rejects the Deployment.
strategy.rollingUpdate.maxUnavailable: 25%Default share of desired Pods that may be down during a rollout; 25% keeps at least 75% running.
strategy.rollingUpdate.maxSurge: 25%Default extra Pods allowed above replicas during a rollout, so up to 125% can exist at once.
revisionHistoryLimit: 10Number of old ReplicaSets kept for rollback by default; setting 0 makes kubectl rollout undo impossible.
progressDeadlineSeconds: 600Seconds before a stuck rollout is reported with reason ProgressDeadlineExceeded; 600 is the default.
pod-template-hashLabel the controller adds to each ReplicaSet and its Pods; don't set or change it yourself.
type: ClusterIPDefault Service type; gives a cluster-internal virtual IP reachable only from inside the cluster.
type: NodePortOpens the same port on every node; allocated from 30000-32767 unless --service-node-port-range changes it.
type: LoadBalancerAsks the cloud provider for an external load balancer in front of the Service.
type: ExternalNameReturns a CNAME to an outside DNS name instead of proxying to Pods.
targetPort: http-webPoints at a named container port, so the Pod can change its port number without editing the Service; when omitted, targetPort equals port.
clusterIP: NoneMakes a headless Service: no virtual IP, and DNS returns the individual Pod IPs.
Gateway API kinds use apiVersion: gateway.networking.k8s.io/v1 (Gateway API page). They need a controller and the CRDs installed in the cluster.
pathType: PrefixMatches by /-separated path elements, so /aaa/bbb matches /aaa/bbb/ccc but not /aaa/bbbxyz.
pathType: ExactMatches the path exactly and case-sensitively; /foo doesn't match /foo/. Wins over Prefix for the same path.
pathType: ImplementationSpecificLeaves matching to the IngressClass controller; every Ingress path must set some pathType or validation fails.
ingressClassName: nginxPicks which controller handles the Ingress; without it you rely on a default IngressClass existing.
kind: GatewayClass / Gateway / HTTPRouteGateway API split: the class names the controller, the Gateway defines listeners, and HTTPRoutes attach routing rules.
ConfigMap limits and update rules are on the ConfigMap page.
data: (base64 values)Every value under a Secret's data must be base64-encoded; base64 hides the value but doesn't protect it.
stringData:Lets you write Secret values as plain text and have the API encode them; doesn't play well with server-side apply.
1 MiBSize cap for a single ConfigMap and for a single Secret; split anything larger or use a volume.
envFrom / env.valueFrom.configMapKeyRefValues injected as environment variables are not refreshed when the ConfigMap changes; restart the Pod.
volumes: configMapKeys mounted as files are updated eventually, after the kubelet sync period plus cache delay; a subPath mount never updates.
encryption at restSecrets are stored unencrypted in etcd by default, so turn on encryption at rest and limit RBAC on them.
cpu: 500mHalf a CPU; 0.5 means the same, and nothing finer than 1m is allowed.
memory: 512MiBinary suffixes (Ki, Mi, Gi, Ti, Pi, Ei) are powers of 1024; M, G and so on are powers of 1000.
memory: 400mMeans 0.4 bytes because lowercase m is milli; you almost certainly meant 400Mi or 400M.
limits only, no requestsIf no LimitRange default applies, Kubernetes copies the limit into the request.
over the cpu limitThe container is throttled, not killed.
over the memory limitThe kernel may OOM-kill the container when it detects memory pressure.
readinessProbeOn failure the Pod's Ready condition goes false and it stops getting Service traffic; the container keeps running.
livenessProbeAfter failureThreshold failures in a row the kubelet restarts the container.
startupProbeHolds back liveness and readiness checks until it succeeds; give it failureThreshold * periodSeconds of headroom.
periodSeconds: 10 / timeoutSeconds: 1Defaults: probe every 10 seconds, and treat no answer within 1 second as a failure.
failureThreshold: 3 / successThreshold: 1Defaults; successThreshold must stay 1 for liveness and startup probes.
httpGet / tcpSocket / grpc / execCheck mechanisms; httpGet judges only the status code and stops reading the body after 10KiB.
httpHeaders: HostSet a Host header instead of host: when the app uses virtual hosts; the probe goes to the Pod IP by default.
app.kubernetes.io/name: myappLabel key with an optional DNS-style prefix (253 chars max) and a name part of 63 chars max.
environment = productionEquality-based selector; = and == are synonyms and != means not equal.
environment in (production, qa)Set-based selector; also supports notin and plain key existence like tier or !tier.
matchExpressions:Set-based form inside spec.selector for Deployments and similar objects; there is no OR between requirements.
Worked example: A Deployment with safe probes and resources, exposed by a Service
Say your API boots in up to two minutes and listens on port 8080. Write the Deployment with a named port, a startup probe sized for the slow boot, and a readiness probe that guards traffic:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: api
template:
metadata:
labels:
app.kubernetes.io/name: api
spec:
containers:
- name: api
image: registry.example.com/api:1.4.2
ports:
- name: http
containerPort: 8080
resources:
requests: {cpu: 250m, memory: 256Mi}
limits: {memory: 256Mi}
startupProbe:
httpGet: {path: /healthz, port: http}
periodSeconds: 10
failureThreshold: 12
readinessProbe:
httpGet: {path: /ready, port: http}
livenessProbe:
httpGet: {path: /healthz, port: http}
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app.kubernetes.io/name: api
ports:
- port: 80
targetPort: http
The startup probe allows 12 x 10 = 120 seconds before the kubelet gives up, and liveness checks don't start until it passes, so a slow boot can't trigger a restart loop. The readiness probe uses the defaults (every 10 seconds, 3 failures), which is enough to pull a busy Pod out of the Service without killing it. Memory has a request and an equal limit; CPU has only a request, so the app can use spare CPU instead of being throttled. The Service has no type, so it is a ClusterIP, and targetPort: http follows the named port. I haven't applied this to a cluster; after kubectl apply -f, look for all three Pods reaching 1/1 READY and for the Service's EndpointSlice listing three addresses.
Common mistakes
Writing
memory: 512mand wondering why the Pod never schedules or gets killed straight away.Lowercase
mis milli. Use512Mi(or512M) for memory and keepmfor CPU only.Pointing the liveness probe at an endpoint that checks the database.
If the database blips, every Pod restarts at once. Check dependencies in the readiness probe and keep liveness to the process itself.
Changing
spec.selectoron an existing Deployment to rename the app label.The selector is immutable. Create a new Deployment with the new labels, move traffic, then delete the old one.
Editing a ConfigMap and expecting environment variables in running Pods to change.
Env values are read at container start. Run a rollout restart, or mount the ConfigMap as a volume without
subPathif the app can reload files.Treating base64 in a Secret as encryption and committing the YAML to Git.
Anyone can decode it. Keep Secret manifests out of the repo or use a sealed or external secrets tool, and enable encryption at rest.
Leaving out
pathTypeon an Ingress path copied from an old blog post.Current Ingress validation rejects paths without it. Add
pathType: PrefixorExact, or write an HTTPRoute instead.
Related cheat sheets
Sources
- https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
- https://kubernetes.io/docs/concepts/services-networking/service/
- https://kubernetes.io/docs/concepts/services-networking/ingress/
- https://kubernetes.io/docs/concepts/services-networking/gateway/
- https://kubernetes.io/docs/concepts/configuration/configmap/
- https://kubernetes.io/docs/concepts/configuration/secret/
- https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
- https://kubernetes.io/docs/concepts/configuration/liveness-readiness-startup-probes/
- https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
- https://kubernetes.io/releases/
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.