🚨 Production Incident Scenarios: Interactive Q&A Handbook#
🟢 Production Incident Runbooks#
❓ Q1: Incident: CPU is at 100% utilization. How do you troubleshoot?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Identify Bottleneck Process: Run
top or htop to identify the processes consuming the most CPU.
- Investigate Thread Details: Press
H in top to view individual threads.
- Trace System Calls: Run
strace -p <PID> to see system calls made by the process.
- Identify Core Source: Match the process ID against logs. If it is Java, run
jstack <PID> to dump threads and identify code bottlenecks.
- Mitigate: If the process is not critical, kill it (
kill -9 <PID>). Otherwise, scale up or restart the service.
❓ Q2: Incident: Memory leak investigation. How do you diagnose?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
A memory leak occurs when an application allocates memory but fails to release it, causing RAM consumption to increase over time.
- Monitor usage: Track memory trends using
free -m and look for steady upward curves.
- Trace OOM events: Check kernel logs for Out-Of-Memory termination signals:
dmesg -T | grep -i oom or grep -i kill /var/log/messages.
- Profile Heap Memory:
- For Node.js: Generate a heap snapshot using
--inspect flag.
- For Java: Take a heap dump using
jmap -dump:format=b,file=heap.bin <PID> and analyze it using Eclipse Memory Analyzer (MAT).
❓ Q3: Incident: Disk is 100% full. How do you recover?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Find largest files: Run
du -sh /* 2>/dev/null | sort -rh to isolate directories.
- Safely Truncate Active Logs: If a log file is held open by a process, deleting it with
rm will not release disk space. Instead, truncate the file: > /var/log/nginx/access.log.
- Purge Cache: Run package cleanups (e.g.,
apt-get clean or docker system prune -af).
- Configure Logrotate: Ensure long-term rotation is set up.
❓ Q4: Incident: Database connection exhaustion. How do you resolve?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Symptoms: Application returns
500 Internal Server Error with Too many connections messages.
- Immediate Fix:
- Connect to DB as admin and terminate idle, hung connections.
- Temporarily increase maximum connection parameters (e.g.,
max_connections in Postgres/MySQL).
- Permanent Fix:
- Implement connection pooling in the application layer (e.g., HikariCP, PgBouncer).
- Scale database instance size or route read traffic to read-replicas.
❓ Q5: Incident: Kubernetes Pod is in CrashLoopBackOff. How do you debug?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Run
kubectl logs <pod-name> to check stdout/stderr outputs.
- Check previous failed instance logs:
kubectl logs <pod-name> --previous.
- Run
kubectl describe pod <pod-name> and look at the Events section to check for OOMKilled errors, failed probes, or volume mount errors.
- Check if configuration maps or secrets referenced in the pod spec actually exist in the namespace.
❓ Q6: Incident: Kubernetes Node is in NotReady state. How do you troubleshoot?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
A NotReady status means the node is not responding to control plane heartbeats.
- SSH into Node: Log in directly to the affected node.
- Check Kubelet daemon: Run
systemctl status kubelet to see if the agent is running.
- Check system resources: Verify if the node is experiencing disk pressure, memory pressure, or PID exhaustion using
df -h and free -m.
- Audit Logs: Inspect kubelet logs:
journalctl -u kubelet -n 100 --no-pager.
- Check Docker/Containerd: Ensure the container runtime is active (
systemctl status containerd).
❓ Q7: Incident: Kubernetes Pod is stuck in Pending state. Why?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
A Pending status means the scheduler cannot place the pod on any node.
- Run
kubectl describe pod <pod-name> and read the latest events.
- Common Causes:
- Insufficient Resources: Nodes do not have enough unallocated CPU/RAM requests to satisfy the pod's requests.
- Taints & Tolerations: The pod does not tolerate node taints.
- Unattached Volumes: The pod is requesting a Persistent Volume (PV) that is located in a different Availability Zone.
❓ Q8: Incident: High API latency. How do you identify the bottleneck?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Analyze HTTP Metrics: Check latency durations at the load balancer (ALB) and separate connection time from target response time.
- Distributed Tracing: Query Jaeger or AWS X-Ray using the request Correlation ID to trace spans across microservices.
- Database query check: Check for slow database queries in DB engine logs.
- Resource Bottlenecks: Verify if downstream containers are experiencing CPU throttling or memory swapping.
❓ Q9: Incident: DNS resolution failure. How do you diagnose?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Verify resolve configurations:
cat /etc/resolv.conf.
- Test using direct nameservers:
dig google.com @8.8.8.8 (isolates local DNS server issues from network routing issues).
- Check if local DNS service is running (e.g., systemd-resolved, CoreDNS in K8s).
- Verify security group rules permit outbound UDP port 53 traffic.
❓ Q10: Incident: Load balancer unhealthy backends. How do you resolve?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Verify the backend application port matches the health check target.
- Run
curl -Iv http://localhost:<port>/healthz directly on the server to check if the health check endpoint returns 200 OK.
- Audit security groups to ensure the load balancer IP is allowed to access the backend instance port.
- Check application log files for runtime startup errors.
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Retrieve backup: Remote backends like S3 keep history/versioning. Locate the previous version of the state file.
- Force state unlock: If the state is locked by a failed run, run
terraform force-unlock <lock-id>.
- Run state commands: Use
terraform state pull > state.json to inspect the JSON schema and correct entries manually, then restore using terraform state push.
❓ Q12: Incident: CI/CD pipeline failure. How do you troubleshoot?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Review build runner logs.
- Isolate the failed step (e.g., dependency check, unit tests, code linting).
- Check runner resources (e.g., runner container running out of disk space).
- Verify access secrets/credentials used in the pipeline are active.
❓ Q13: Incident: Application 502 Bad Gateway. How do you resolve?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
A 502 means the reverse proxy (Nginx, Ingress) received an invalid response from the backend application.
- Check if the backend process is running:
ps aux or systemctl status.
- Verify the backend is listening on the expected port:
ss -tulnp.
- Review proxy error log files (
/var/log/nginx/error.log).
- Confirm backend host name resolves correctly within the internal network.
❓ Q14: Incident: Application 504 Gateway Timeout. How do you troubleshoot?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
A 504 means the proxy gateway waited too long for the upstream application server to return data.
- Audit database lock tables or slow queries that might halt request processing.
- Check for network packet loss or routing issues between proxy and backend.
- Increase proxy connection timeouts (e.g., Nginx
proxy_read_timeout parameters).
- Verify external dependency APIs are not hanging.
❓ Q15: Incident: SSL certificate expiry. How do you quickly resolve?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Renew the certificate immediately from CA (e.g., Let's Encrypt, DigiCert).
- Deploy the new
.crt and .key files to the target load balancer, CDN, or web server.
- Reload the web server daemon configuration:
systemctl reload nginx.
- Validate using
openssl s_client -connect domain.com:443 | grep -i expiry.
❓ Q16: Incident: Production deployment failed. How do you execute a rollback?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- GitOps: Revert the bad commit in Git (
git revert <hash>) and push to main, triggering auto-sync.
- Kubernetes: Run
kubectl rollout undo deployment/<deployment-name> to revert to the previous ReplicaSet snapshot.
- Cloud (Blue-Green): Toggle the ALB listener rules to point 100% of user traffic back to the green target group.
❓ Q17: Incident: Data corruption in database. What is the DR recovery flow?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Isolate database: Revoke write permissions to block further corruptions.
- Identify Point-in-Time: Find the exact timestamp before corruption occurred.
- Restore Backup: Initiate AWS RDS Point-in-Time Recovery (PITR) to restore a backup instance to the selected timestamp.
- Verify Integrity: Run integrity checks.
- DNS Switch: Swap connections to point applications to the restored database instance.
❓ Q18: Incident: Region outage. How do you execute disaster recovery?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Identify the region loss (e.g., AWS
us-east-1 outage).
- Trigger failover routing via Route 53 DNS (or let it failover automatically via health check latency routing).
- Verify the hot/warm standby region cluster has scaled up.
- Promote RDS cross-region read-replicas to primary database instances.
- Validate application health.
❓ Q19: Incident: Ransomware attack. How do you recover?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Isolation: Terminate network connectivity on affected systems immediately.
- Audit: Identify compromised databases and access keys.
- Rotate credentials: Update all root and service account passwords.
- Re-provision: Build clean infrastructure using Terraform.
- Restore: Mount clean data backups from offline, immutable, or write-once-read-many (WORM) storage.
❓ Q20: Incident: Secrets leaked to public GitHub repository. What do you do?#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
- Revoke immediately: Treat the secret as compromised. Revoke the API key/password in the target system.
- Generate new secret: Create new credentials and update application secret managers.
- Purge Git history: Use Git-filter-repo or BFG Repo-Cleaner to delete the file from local repository history and push-force.
- Review Audit Logs: Audit system access logs (e.g., CloudTrail) to verify if the leaked key was abused.
❓ Q21: Describe your approach to handling data migrations in a continuous deployment pipeline.#
Click on the dropdown below to reveal the technical answer.
💡 Reveal Technical Answer
Answer:
Database schema migrations present a high risk of application downtime during CD pipeline runs. The process requires careful coordination to maintain compatibility:
- Enforce Backward Compatibility: Design schema changes so the old application version can run on the new schema. (e.g., if adding a new column, configure it to accept null values initially).
- Use Migration Tools: Manage schema versions using migration tools like Flyway or Liquibase to run version-controlled, repeatable SQL scripts.
- Execute in Phased Stages:
- Phase 1 (Pre-deployment): Run migrations to add new tables, columns, or indexes. Old application containers continue to read from and write to the database.
- Phase 2 (Deployment): Deploy the new application version that utilizes the new schema columns.
- Phase 3 (Post-deployment): Once the new release is verified, run a cleanup script to drop or alter deprecated columns or tables.
- Idempotency: Enforce migration scripts to be idempotent (able to run multiple times without causing errors or data corruption).
- Scheduled Backups: Always run automated database backups immediately before executing migration scripts to facilitate quick recovery.