This Kubernetes deployment guide provides a reusable checklist for building, reviewing, and operating a production-ready Deployment. You will see how to structure a manifest, set resource expectations, add health checks, manage configuration, observe rollouts, recover with rollbacks, and identify the details worth revisiting as your cluster and delivery workflow change.
Overview
A Kubernetes Deployment describes how a stateless application should run and how Kubernetes should replace its Pods when the desired state changes. A sound manifest is more than an image name and a replica count. It should make ownership, scheduling expectations, application health, configuration, security, and release behavior explicit enough for both operators and automation.
The examples below assume a workload managed through a declarative workflow, such as version-controlled manifests, a package manager, or a GitOps process. The exact surrounding tools may differ, but the checks remain useful across environments. Before applying a manifest, confirm the target namespace, cluster context, image registry, and application port. A correct YAML file applied to the wrong cluster is still an operational failure.
For related capacity planning, see the Kubernetes resource requests and limits guide. If the Deployment is part of a larger release process, pair this checklist with the CI/CD pipeline design checklist for small teams.
A minimal production-oriented shape
apiVersion: apps/v1
kind: Deployment
metadata:
name: web
labels:
app.kubernetes.io/name: web
app.kubernetes.io/component: server
spec:
replicas: 3
selector:
matchLabels:
app.kubernetes.io/name: web
strategy:
type: RollingUpdate
template:
metadata:
labels:
app.kubernetes.io/name: web
spec:
containers:
- name: web
image: registry.example.com/web:2025-01-15
ports:
- name: http
containerPort: 8080
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
memory: 256Mi
readinessProbe:
httpGet:
path: /ready
port: http
livenessProbe:
httpGet:
path: /health
port: httpTreat these values as examples, not universal sizing advice. Resource values, probe paths, replica counts, and rollout settings should reflect the service's behavior and its traffic pattern.
Checklist by scenario
Before creating or changing a Deployment
- Use the appropriate API version. For standard Deployments, use
apps/v1and validate the manifest against the Kubernetes versions supported by your platform. - Make naming and labels consistent. Use labels that identify the application and, where useful, its component, environment, or ownership. The
spec.selector.matchLabelsmust match the corresponding Pod-template labels. - Set an intentional replica count. Do not assume that more replicas automatically improve reliability. Confirm that the application can run concurrently and that the cluster has capacity for the requested Pods.
- Pin the container image. Use a release tag or digest that your delivery process can trace to source and build metadata. Avoid relying on a mutable default tag for controlled releases.
- Declare resources. Set CPU and memory requests so the scheduler can make an informed placement decision. Set limits only when they reflect an understood operational policy; a memory limit that is too low can cause restarts, while CPU limits can affect burst behavior.
- Define the container contract. Name ports, specify environment variables deliberately, and document the process assumptions behind the image. A named port can also make probe and Service configuration easier to read.
- Keep configuration separate from the image. Use ConfigMaps for non-sensitive configuration and Secrets for sensitive values. Restrict access to Secrets and avoid placing credentials directly in a manifest committed to source control.
When adding health checks
- Use readiness to control traffic. A readiness probe should answer whether the Pod can serve requests now. It may depend on local initialization, required configuration, or a deliberately chosen dependency check.
- Use liveness to detect stuck processes. A liveness probe should identify a process that cannot recover on its own. Do not make it so dependent on external services that a temporary dependency outage causes unnecessary restarts.
- Consider startup behavior. For applications with slow or variable initialization, a startup probe can give the process time to become ready before liveness checking begins.
- Set timing values from observation. Review the initial delay, period, timeout, and failure threshold against real startup and response times. A probe that is too aggressive can create a restart loop; one that is too permissive can delay detection.
- Test the endpoints. Verify that the path, port, protocol, and expected response work from inside the container. A health endpoint should be cheap and should not expose sensitive diagnostic data.
During a rollout
- Apply the change through the normal delivery path and record the image, manifest revision, and target environment.
- Watch the rollout with
kubectl rollout status deployment/web -n <namespace>. - Inspect Pods, events, and the ReplicaSets if progress stops:
kubectl get pods -n <namespace>,kubectl describe deployment web -n <namespace>, andkubectl get rs -n <namespace>. - Check application-level signals, not only Pod status. Review logs, request errors, latency, saturation, and relevant SLO indicators.
- Confirm that traffic is reaching the intended revision and that old Pods are removed only after the new revision is ready.
When a rollout must be reversed
If the new revision is unhealthy and mitigation requires returning to the previous known-good version, inspect the revision history with kubectl rollout history deployment/web -n <namespace>. Roll back with kubectl rollout undo deployment/web -n <namespace>, or select a specific revision when your release process requires it. Monitor the rollback just as you would a forward rollout, then document the cause and the follow-up fix. Rollback is a mitigation, not a substitute for understanding what failed.
For changes that need smaller exposure or automated promotion, use the progressive delivery readiness checklist to evaluate feature flags, health metrics, and safe rollback conditions.
What to double-check
Selectors and labels: Confirm that the selector is stable and uniquely identifies the Deployment's Pods. Changing a Deployment selector after creation is generally not a routine update; plan label changes carefully and validate them before applying.
Configuration precedence: Check whether values come from image defaults, environment variables, mounted files, or command-line arguments. Make the precedence clear so an operator can explain the effective configuration during an incident.
Security context: Review whether the container can run as a non-root user, whether the root filesystem can be read-only, and which Linux capabilities are actually needed. These settings depend on the image, so test them rather than copying them blindly.
Availability during replacement: Consider a PodDisruptionBudget where appropriate, but remember that it does not make an application highly available by itself. Validate replica placement, topology constraints, and the behavior of the Service or ingress layer as well.
Graceful termination: Confirm that the application handles termination signals, stops accepting new work, and has enough termination time to finish or safely abandon in-flight requests. A readiness transition and application shutdown behavior should work together.
Observability: Ensure that logs identify the revision, metrics distinguish the service and environment, and traces or request identifiers are available where needed. A Deployment that is easy to apply but difficult to diagnose is not production-ready.
Release gates: Connect the manifest to tests that catch invalid YAML, schema errors, failed image references, missing configuration, and API contract regressions. The API contract testing guide can help when a rollout changes an interface used by other services.
Common mistakes
- Using only a liveness probe. Liveness answers whether a process should be restarted; it does not tell the Service when the Pod is ready for traffic. Add readiness behavior that reflects the application.
- Making probes test too much. A readiness or liveness endpoint that requires every downstream dependency can turn a short outage into a fleet-wide restart or traffic failure.
- Leaving requests unset. Without meaningful requests, scheduling and capacity planning become harder to reason about, especially when several workloads compete for a node.
- Changing several dimensions at once. An image change, configuration rewrite, resource adjustment, and probe change in one release make failures harder to attribute. Separate changes when practical.
- Assuming a successful apply means a successful release. The API server accepting a manifest does not prove that Pods became ready or that users received healthy responses.
- Relying on rollback without retained history. Keep enough revision and release metadata to identify the prior version, and ensure the previous image remains available in the registry.
- Ignoring namespace and context. Include explicit namespace handling in scripts and confirm the active context before running commands that change workloads.
When a deployment fails in CI/CD, correlate pipeline output with Kubernetes events and application logs rather than retrying repeatedly. The CI/CD pipeline failure troubleshooting guide provides a broader diagnostic sequence.
When to revisit
Revisit this Kubernetes deployment checklist before a new service goes live, before a seasonal or planned traffic increase, and whenever the image, runtime, configuration, traffic profile, or cluster policy changes. Also review it after an incident, a repeated probe failure, a resource-related eviction, or a rollback. These events often reveal assumptions that were invisible during normal operation.
Refresh manifests and command examples when your organization upgrades Kubernetes, changes admission or security policies, adopts a new ingress or service pattern, or standardizes a different deployment controller. Validate API versions and fields against the versions your platform actually supports; do not copy an example solely because it worked in another cluster.
For a practical review, open the manifest and answer these questions: Can another operator identify the owner and revision? Are requests, limits, and replica counts based on observed behavior? Do readiness, liveness, and startup checks represent distinct conditions? Can the team see a bad rollout quickly? Is the previous revision recoverable? Are secrets protected? If any answer is unclear, create a small corrective change, test it in a representative environment, and record the operational decision in the repository.
Finally, pair Deployment reviews with broader operational checks: audit access through the cloud IAM access review runbook, review service objectives with the SLO and error budget worksheet, and document incident follow-up using the SRE incident response runbook template. A production-ready Kubernetes Deployment is not a fixed YAML pattern; it is a tested, observable, and maintainable agreement between the application and the platform.