Skip to content

Menu

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.

What each probe does on failureThe startup probe holds back the other two; a failed readiness probe only stops traffic, while failed liveness checks restart the container.Container startsstartupProbeholds back liveness and readiness until itsucceedsProbe every 10 sno answer within 1 s counts as a failurereadinessProbefailsReady false, noService traffic;container keepsrunninglivenessProbefails3 in a row(failureThreshold):kubelet restarts it
The startup probe holds back the other two; a failed readiness probe only stops traffic, while failed liveness checks restart the container.

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: Deployment

Header for a Deployment manifest; Deployments live in the apps/v1 API group.

Try it: kubernetes-yaml-generatorFrom the docs, not run by us
spec.selector.matchLabels

Must match spec.template.metadata.labels, or the API server rejects the Deployment.

From the docs, not run by us
strategy.rollingUpdate.maxUnavailable: 25%

Default share of desired Pods that may be down during a rollout; 25% keeps at least 75% running.

From the docs, not run by us
strategy.rollingUpdate.maxSurge: 25%

Default extra Pods allowed above replicas during a rollout, so up to 125% can exist at once.

From the docs, not run by us
revisionHistoryLimit: 10

Number of old ReplicaSets kept for rollback by default; setting 0 makes kubectl rollout undo impossible.

From the docs, not run by us
progressDeadlineSeconds: 600

Seconds before a stuck rollout is reported with reason ProgressDeadlineExceeded; 600 is the default.

From the docs, not run by us
pod-template-hash

Label the controller adds to each ReplicaSet and its Pods; don't set or change it yourself.

From the docs, not run by us
type: ClusterIP

Default Service type; gives a cluster-internal virtual IP reachable only from inside the cluster.

From the docs, not run by us
type: NodePort

Opens the same port on every node; allocated from 30000-32767 unless --service-node-port-range changes it.

From the docs, not run by us
type: LoadBalancer

Asks the cloud provider for an external load balancer in front of the Service.

From the docs, not run by us
type: ExternalName

Returns a CNAME to an outside DNS name instead of proxying to Pods.

From the docs, not run by us
targetPort: http-web

Points at a named container port, so the Pod can change its port number without editing the Service; when omitted, targetPort equals port.

From the docs, not run by us
clusterIP: None

Makes a headless Service: no virtual IP, and DNS returns the individual Pod IPs.

From the docs, not run by us

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: Prefix

Matches by /-separated path elements, so /aaa/bbb matches /aaa/bbb/ccc but not /aaa/bbbxyz.

From the docs, not run by us
pathType: Exact

Matches the path exactly and case-sensitively; /foo doesn't match /foo/. Wins over Prefix for the same path.

From the docs, not run by us
pathType: ImplementationSpecific

Leaves matching to the IngressClass controller; every Ingress path must set some pathType or validation fails.

From the docs, not run by us
ingressClassName: nginx

Picks which controller handles the Ingress; without it you rely on a default IngressClass existing.

From the docs, not run by us
kind: GatewayClass / Gateway / HTTPRoute

Gateway API split: the class names the controller, the Gateway defines listeners, and HTTPRoutes attach routing rules.

From the docs, not run by us

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.

From the docs, not run by us
stringData:

Lets you write Secret values as plain text and have the API encode them; doesn't play well with server-side apply.

From the docs, not run by us
1 MiB

Size cap for a single ConfigMap and for a single Secret; split anything larger or use a volume.

From the docs, not run by us
envFrom / env.valueFrom.configMapKeyRef

Values injected as environment variables are not refreshed when the ConfigMap changes; restart the Pod.

From the docs, not run by us
volumes: configMap

Keys mounted as files are updated eventually, after the kubelet sync period plus cache delay; a subPath mount never updates.

From the docs, not run by us
encryption at rest

Secrets are stored unencrypted in etcd by default, so turn on encryption at rest and limit RBAC on them.

From the docs, not run by us
cpu: 500m

Half a CPU; 0.5 means the same, and nothing finer than 1m is allowed.

memory: 512Mi

Binary suffixes (Ki, Mi, Gi, Ti, Pi, Ei) are powers of 1024; M, G and so on are powers of 1000.

memory: 400m

Means 0.4 bytes because lowercase m is milli; you almost certainly meant 400Mi or 400M.

limits only, no requests

If no LimitRange default applies, Kubernetes copies the limit into the request.

From the docs, not run by us
over the cpu limit

The container is throttled, not killed.

From the docs, not run by us
over the memory limit

The kernel may OOM-kill the container when it detects memory pressure.

From the docs, not run by us
readinessProbe

On failure the Pod's Ready condition goes false and it stops getting Service traffic; the container keeps running.

From the docs, not run by us
livenessProbe

After failureThreshold failures in a row the kubelet restarts the container.

From the docs, not run by us
startupProbe

Holds back liveness and readiness checks until it succeeds; give it failureThreshold * periodSeconds of headroom.

From the docs, not run by us
periodSeconds: 10 / timeoutSeconds: 1

Defaults: probe every 10 seconds, and treat no answer within 1 second as a failure.

From the docs, not run by us
failureThreshold: 3 / successThreshold: 1

Defaults; successThreshold must stay 1 for liveness and startup probes.

From the docs, not run by us
httpGet / tcpSocket / grpc / exec

Check mechanisms; httpGet judges only the status code and stops reading the body after 10KiB.

From the docs, not run by us
httpHeaders: Host

Set a Host header instead of host: when the app uses virtual hosts; the probe goes to the Pod IP by default.

From the docs, not run by us
app.kubernetes.io/name: myapp

Label key with an optional DNS-style prefix (253 chars max) and a name part of 63 chars max.

From the docs, not run by us
environment = production

Equality-based selector; = and == are synonyms and != means not equal.

From the docs, not run by us
environment in (production, qa)

Set-based selector; also supports notin and plain key existence like tier or !tier.

From the docs, not run by us
matchExpressions:

Set-based form inside spec.selector for Deployments and similar objects; there is no OR between requirements.

From the docs, not run by us

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: 512m and wondering why the Pod never schedules or gets killed straight away.

    Lowercase m is milli. Use 512Mi (or 512M) for memory and keep m for 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.selector on 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 subPath if 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 pathType on an Ingress path copied from an old blog post.

    Current Ingress validation rejects paths without it. Add pathType: Prefix or Exact, or write an HTTPRoute instead.