Scenario
On an ordinary Thursday afternoon, your team pushes a new version of the application to a Kubernetes cluster through your CI/CD pipeline. Within minutes, monitoring alerts begin to fire — error rate spikes, P95 latency exceeds 3 seconds, and the rolling update is stuck with only one replica updated. The release lead tries to roll back, but the pipeline has already executed subsequent steps, overwriting the image tag, and the rollback action sparks even more chaos.
This scenario is not rare. Modern DevOps emphasizes speed, but release processes without guardrails can turn a small mistake into an outage. This article walks through a typical incident, showing you how to diagnose CI/CD-driven issues and establish a set of actionable release guardrails.
Symptoms
When a release starts spiraling, you often see these signs:
- Rolling update hangs:
kubectl rollout status deployment/webuinever succeeds; new Pods remain in ContainerCreating or CrashLoopBackOff. - Health checks fail: Liveness and readiness probes keep failing; old Pods are not replaced, new Pods cannot receive traffic.
- Error rate soars: Application logs fill with 5xx errors, downstream services time out, and database connection pools are exhausted.
- Pipeline state is inconsistent: CI reports success but CD fails; or the pipeline skips human approval and pushes an unverified image.
Diagnosis
To find the root cause, do not jump straight into code. Gather evidence systematically:
- Review pipeline logs: Identify the stage that failed or behaved anomalously. Verify that the image tag, environment variables, and deployment parameters match expectations.
- Check Kubernetes events:
kubectl get events --sort-by=.lastTimestamp -n productionwill reveal why Pods were rejected or failed — image pull errors, quota limits, probe misconfigurations. - Inspect Pod details: Use
kubectl describe pod <pod-name> -n productionto inspect status and recent events, especially the Events section. - Compare old and new versions: If possible, diff the current image against the last known-good release. This quickly identifies configuration drift or dependency changes.
Commands
Here are your primary toolbelt commands during diagnosis and recovery:
# Check rollout status, with timeout to avoid hanging
timeout 30 kubectl rollout status deployment/webui -n production
# List Pods and identify abnormal replicas
kubectl get pods -n production -l app=webui
# Inspect a specific Pod, including events
kubectl describe pod <pod-name> -n production
# Get cluster events sorted by timestamp
kubectl get events --sort-by=.lastTimestamp -n production
# If deployment config is suspect, view current definition
kubectl get deployment webui -n production -o yaml
Safety note: Use timeout to avoid endless hangs, but do not delete Pods or modify deployments arbitrarily in production unless you have a confirmed recovery strategy.
Risk Controls
To prevent a repeat, establish guardrails at both process and tooling levels:
- Automated gates: Add automated tests, security scans, and image signature verification to the pipeline. Any failure must halt the pipeline.
- Human approval points: For production, require at least one peer review approval before proceeding. This can be configured in Jenkins, GitLab CI, or Argo Rollouts.
- Phased deployments: Use blue-green or canary releases. Native Kubernetes rolling updates do not have automatic rollback capabilities; consider Argo Rollouts or Flagger.
- Policy as code: Use OPA (Open Policy Agent) or Kyverno to validate security context, resource limits, image registries, and other rules before Deployment resources enter the cluster.
- Automatic rollback: Configure readiness probes to trigger automatic rollback to the last stable version. Argo Rollouts'
setRollbackWindowandanalysisfeatures can enforce this precisely. - Monitoring and alerting: Build release-time SLO monitoring, such as error budget and latency budget. When metrics degrade, immediately trigger the rollback process.
Rollback
If you need manual rollback, use the following commands:
# List revisions to see what you're rolling back to
kubectl rollout history deployment/webui -n production
# Rollback to the previous version
kubectl rollout undo deployment/webui -n production
# Or specify a particular revision
kubectl rollout undo deployment/webui --to-revision=3 -n production
Safety note: Before rolling back, assess database migrations and API compatibility. If the new version changed the DB schema, a simple undo might cause old code to clash with the incompatible schema. Restore a database backup or run reverse migrations if necessary.
Verification
After rolling back, do not just check that Pods are running; verify business recovery:
# Confirm rollout is complete
kubectl rollout status deployment/webui -n production
# Check Pod counts and statuses
kubectl get pods -n production -l app=webui
# Tail application logs to confirm no error stacks
kubectl logs <pod-name> -n production --tail=50
# Validate health endpoint (adjust for your service)
curl -H "Host: webui.internal" http://127.0.0.1:80/healthz
Also watch error rate, latency, and SLO metrics on your dashboards for at least 15 minutes. Run end-to-end smoke tests that simulate critical user journeys.
When to Submit an OpsGlobal Ticket
Submit an OpsGlobal ticket if you encounter any of the following:
- Rollback fails, or the issue persists after rollback and you cannot pinpoint the root cause.
- The cluster state is unrecoverable, such as etcd corruption or a deleted namespace.
- Your team lacks advanced Kubernetes debugging experience and needs rapid containment.
- You suspect a security exploit is involved and need professional forensics.
OpsGlobal's SRE team can intervene within minutes, offering full support from pipeline audit to cluster recovery, helping you restore service and harden your release process.
Use cases
Useful for teams handling CI/CD issues and needing a clear troubleshooting and delivery workflow.
Problem background
Learn how to bake safety into your CI/CD pipeline. From detecting problematic releases to automatic rollback and verification, we walk through concrete Kubernetes debugging and release guardrails to help your SRE team cut incident rates.
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.