Closes #938
Both backend and frontend deployments use RollingUpdate with:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0maxUnavailable: 0 guarantees zero downtime — old pods stay up until new pods pass readiness.
New pods must pass the readiness probe before receiving traffic:
| Service | Probe path | Period | Failure threshold |
|---|---|---|---|
| Backend | GET /health |
5s | 3 (15s total) |
| Frontend | GET /api/healthz |
5s | 3 (15s total) |
A startup probe allows up to 60 s for the container to initialise before liveness kicks in.
# Update the image tag
kubectl set image deployment/nova-rewards-backend \
backend=nova-rewards-backend:<NEW_TAG> \
-n nova-rewards
kubectl set image deployment/nova-rewards-frontend \
frontend=nova-rewards-frontend:<NEW_TAG> \
-n nova-rewards
# Watch rollout progress
kubectl rollout status deployment/nova-rewards-backend -n nova-rewards
kubectl rollout status deployment/nova-rewards-frontend -n nova-rewardsIf new pods fail readiness probes the rollout stalls automatically — no traffic is shifted to broken pods. To revert:
kubectl rollout undo deployment/nova-rewards-backend -n nova-rewards
kubectl rollout undo deployment/nova-rewards-frontend -n nova-rewardsVerify the rollback completed:
kubectl rollout status deployment/nova-rewards-backend -n nova-rewards
kubectl rollout status deployment/nova-rewards-frontend -n nova-rewardsMigrations must be backward-compatible so old and new code can run simultaneously during the rolling window:
- Add columns as nullable — never add a
NOT NULLcolumn without a default in the same migration. - Never rename or drop columns in the same release as the code change. Use a two-phase approach:
- Phase 1: add new column, deploy code that writes to both old and new.
- Phase 2 (next release): remove old column.
- Run migrations before deploying new pods:
kubectl run migrate --rm -it --image=nova-rewards-backend:<NEW_TAG> \ --env="DATABASE_URL=$DATABASE_URL" \ -- node database/migrate.js
# List revision history
kubectl rollout history deployment/nova-rewards-backend -n nova-rewards
# Roll back to a specific revision
kubectl rollout undo deployment/nova-rewards-backend \
--to-revision=<REVISION> -n nova-rewards