Many deployment pipelines stop after docker build && docker push and immediately roll out to production. That skips an entire class of failures: broken Kubernetes probes, restrictive securityContext permissions, missing emptyDir mounts, and Ingress port mismatches.
Four-Stage Release Gate
Our GitHub Actions pipeline mirrors a defense-in-depth promotion model:
- Quality & Static Policy Checks: Validate K8s YAML syntax, lint shell scripts with
bash -n, compile the static site with strict warnings, and verify that required hardening directives remain present in manifests. - Container Build & Local Smoke Test: Build the single-arch candidate container, boot it on an isolated runner, and verify
/healthz, HTTP status codes, and security headers viascripts/smoke-test.shbefore publishing multi-arch images (linux/amd64,linux/arm64) toghcr.io. - Ephemeral KinD Verification: Spin up a clean Kubernetes-in-Docker (
KinD) cluster on the runner, load the built image, apply the exactk8s/manifests, wait forrollout status, and re-runsmoke-test.shoverkubectl port-forward. - Immutable Production Rollout: Pull the exact commit-SHA image digest onto the target K3s node, apply manifests, and verify live readiness.
# Run the exact same smoke check against KinD over port-forward
kubectl -n security port-forward svc/security-blog-service 8080:80 &
PORT=8080 ./scripts/smoke-test.sh
By validating the real Kubernetes PodSpec inside KinD on every merge, a misconfigured readOnlyRootFilesystem or probe path fails safely in CI instead of taking down production pods.