CI/CD Best Practices
These are the practices that keep Kubernetes delivery safe, reproducible, and auditable. They assume a build-scan-sign-commit-sync pipeline with a GitOps controller reconciling the cluster.
Search across all documentation pages
These are the practices that keep Kubernetes delivery safe, reproducible, and auditable. They assume a build-scan-sign-commit-sync pipeline with a GitOps controller reconciling the cluster.
Read the groups in order; they roughly follow a request from commit to running Pod. Adopt the git-as-source-of-truth group first, then layer on supply-chain, rollout, and operational practices.
Treat each bold item as a rule with a rationale. Where a rule is aspirational for your team, make it a tracked gap rather than a silent exception.
kubectl apply from laptops to production. Manual applies create untracked state that no one can review or reproduce. All changes flow through git and a controller.git revert. Reverting the deploy commit reconciles the previous state; avoid out-of-band hotfixes that git does not know about.@sha256: reference is immutable, so the running Pod is deterministic and rollback is exact.runAsNonRoot, RuntimeDefault seccomp, and dropped capabilities at the namespace level.You should be able to trace any running Pod back to a commit, a scanned and signed image digest, and a reviewed deploy. No one should need laptop access to the production API server to ship or revert.
If any of that is not true yet, treat the gap as the next piece of work and track it openly.
Why ban kubectl apply to production? It creates state that is not in git, so it is invisible to review, drift detection, and rollback. Route every change through git.
Tag or digest for deploys? Always digest. Tags move; a digest is content-addressed and makes rollouts and rollbacks deterministic.
Should CI have cluster credentials? No. In a GitOps flow CI only builds and commits, and an in-cluster controller pulls and applies, which removes a large credential blast radius.
Is scanning enough, or do I also sign? Both. Scanning checks content for CVEs; signing proves origin so admission control can reject anything your pipeline did not produce.
When is progressive delivery worth it? For high-traffic or high-blast-radius services where a plain rolling update cannot catch regressions before they reach many users.
How do I stop a bad auto-update? Revert the bot's commit in git; the GitOps controller reconciles the previous digest back into the cluster.
Stack versions: This page was written for Kubernetes 1.36.2, Docker Engine 29.6.1 (BuildKit default), containerd (CRI runtime on nodes), Helm 3, Compose v2, Argo CD (latest - verify at build), and Gateway API (GA - verify controller support at build).
Reviewed by Chris St. John·Last updated Jul 16, 2026