Overview
Kubernetes replaces pods as fast as the readiness probe allows, and it does not roll back a stalled Deployment by itself. A probe that only checks that a port is open lets a broken build replace healthy pods, and the rollback then depends on someone knowing which revision to return to.
Challenge
Two releases in one quarter shipped a build that started cleanly and failed on its first database call. Probes passed, so Helm reported success and the Deployments replaced every replica before the alerts fired. Rolling back meant a manual Helm rollback by whoever was on call, and the Deployments kept only two old ReplicaSets.
Environment
A cluster of about 60 services on Google GKE, Helm releases deployed from a CI pipeline, Cloud SQL for PostgreSQL behind most services, and Prometheus alerting.
Approach
AceMQ replayed the two bad releases in a staging namespace to see exactly when each failure became visible, then changed the release path so that a bad build is stopped at the first replica and rolled back without a person having to decide. The changes went in service by service, starting with the three services that carry the most traffic.
Solution
- Replaced port-open readiness checks with endpoints that exercise the database and cache connections each service needs
- Added startup probes so slow starts no longer fail liveness checks
- Set maxUnavailable to 0 with a single surge pod and a progress deadline matched to the measured start time
- Moved the highest-traffic services to Argo Rollouts with an analysis step on error rate and p99 latency that aborts and rolls back
- Raised revisionHistoryLimit so earlier revisions stay available, and added a rollout undo step to the on-call runbook
- Rehearsed a deliberately bad release in staging each month until on-call engineers could roll back from the runbook alone
Outcome
Over the next two quarters one release was aborted automatically at the first replica, and no customer-facing rollout needed a manual rollback. On-call engineers now treat an aborted rollout as routine.