Scenario
A microservice deployment enters CrashLoopBackOff, causing API 503 errors. Investigation reveals the new version is missing a required ConfigMap, so the application fails to start.
Symptoms
- Pods stuck in CrashLoopBackOff
- Service endpoints returning 503
- Monitoring alerts firing
Diagnosis
- Check pod logs:
kubectl logs <pod-name> -n <namespace>
- Describe pod events:
kubectl describe pod <pod-name> -n <namespace>
- Verify ConfigMap existence:
kubectl get configmap <configmap-name> -n <namespace>
Commands and Guardrails
Add these checks to your CI/CD pipeline:
- Pre-deployment validation: Use kubectl diff to compare configuration
kubectl diff -f deployment.yaml
- Integration tests: Run automated tests before deployment
# Inside CI script
kubectl apply -f test-env.yaml
run-integration-tests
kubectl delete -f test-env.yaml
- Canary release: Gradually expose new version
# Using Service Mesh or Deployment strategy
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
canary:
steps:
- setWeight: 10
- pause: {duration: 5m}
- Automatic rollback: Configure Rollout rollback policy
kubectl rollout undo deployment/<deployment-name> -n <namespace>
Risk Controls
- Ensure ConfigMaps and Secrets are created before deployment
- Use Helm or Kustomize to manage configurations, avoiding manual edits
- Implement approval gates: Only allow deployments triggered by code-reviewed PRs
Rollback Steps
- Rollback Kubernetes deployment:
kubectl rollout undo deployment/<deployment-name> -n <namespace>
- If Git-triggered, revert the Git commit:
git revert <commit-hash>
git push origin main
- Verify service recovery:
curl http://<service-url>/healthz
Verification
- Check pod status:
kubectl get pods -n <namespace> - Check endpoints:
kubectl get endpoints <service-name> - Observe monitoring metrics (e.g., request success rate, latency)
When to Submit an OpsGlobal Ticket
- If rollback fails or you cannot access the cluster
- If the issue persists for more than 30 minutes and cause is unknown
- If you need assistance configuring CI/CD guardrails or auditing pipelines
OpsGlobal provides 24/7 support to help you optimize your release process and reduce downtime.
Use cases
Useful for teams handling CI/CD issues and needing a clear troubleshooting and delivery workflow.
Problem background
Learn how to implement effective guardrails in your CI/CD pipelines to prevent deployment failures, with practical commands and rollback strategies.
Troubleshooting steps
Confirm impact and recent changes, collect logs, configuration and metrics, then apply fixes from low to high risk.
Command examples
Replace sample resource names with real values and store passwords, tokens and keys in environment variables.
Risks
Before production changes, confirm backups, access boundaries, change windows and rollback paths.
Rollback plan
Keep original configuration and release versions; roll back config, images or database changes if metrics degrade.
Deliverables
Root-cause notes, key commands, remediation steps, verification results and follow-up recommendations.
Need help with a similar technical issue?
If your servers, Kubernetes, Docker, CI/CD, databases or monitoring systems have similar issues, submit logs and config files for remote diagnosis.