Introduction When a CI/CD deployment health check fails, the pipeline marks the deployment as failed and may trigger a rollback. This blocks releases and requires investigation to determine if the application is actually broken or just slow to start.
Symptoms - Pipeline error: "Health check failed after 300s timeout" - Error: "Deployment rollout status check failed" - Application returns 503 during startup - Deployment shows as failed but pods are running - Rollback automatically triggered
Common Causes - Health check timeout too short for application startup time - Database migrations blocking health check endpoint - Health check endpoint not implemented - Application stuck during initialization - Resource limits too low causing slow startup
Step-by-Step Fix 1. **Check application logs during deployment**: ```bash kubectl logs -l app=my-app --tail=50 --follow ```
- 1.Test health check endpoint manually:
- 2.```bash
- 3.curl -v http://<service-ip>/health
- 4.curl -v http://<service-ip>/ready
- 5.
` - 6.Increase deployment timeout in pipeline:
- 7.```yaml
- 8.# GitHub Actions
- 9.- name: Deploy
- 10.run: |
- 11.kubectl apply -f deployment.yaml
- 12.kubectl rollout status deployment/my-app --timeout=600s
- 13.
`