Deploying application updates without dropping a single active HTTP connection is a fundamental requirement for mission-critical enterprise systems. In this article, we outline the exact production pipeline blueprint used by AxonFlow AI engineers when orchestrating Kubernetes clusters on AWS EKS and GCP GKE.
1. The Four Golden Rules of Zero-Downtime Deployments
Achieving zero downtime requires strict discipline across both application software and infrastructure provisioning:
- Backward-Compatible Database Migrations: Schema changes must always support both old and new code versions simultaneously.
- Graceful Shutdown Signals (SIGTERM): Containers must stop accepting new requests and finish existing connections within a termination grace period.
- Readiness & Liveness Probes: Kubernetes ingress must route traffic only after the container passes health checks.
- Rolling Update Strategies: Pods must be created and verified before old pods are decommissioned.
2. Kubernetes Deployment Specification
Below is our standardized production Kubernetes deployment manifest demonstrating maxSurge and readinessProbe configurations:
apiVersion: apps/v1
kind: Deployment
metadata:
name: core-api-service
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 25%
maxUnavailable: 0
template:
spec:
containers:
- name: api
image: axonflow/core-api:v2.4.1
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 3
3. Database Schema Migration Strategy
To avoid race conditions during deployment, we utilize a 3-step migration pattern:
- Expand: Add new columns or tables without removing old ones. Deploy code that writes to both columns.
- Migrate: Backfill historic data asynchronously in the background.
- Contract: Deprecate and remove old columns only after the new code release is 100% stable.