Stage 1, Part 7 of 9, Kubernetes Fundamentals (Day 0/1)

Text

PART 7: INCIDENT MANAGEMENT

33. Kubernetes Incident Post-Mortem Template

text
INCIDENT: Production Deployment Failed - All Pods CrashLooping
DATE: 2024-01-15
DURATION: 47 minutes
SEVERITY: SEV-1
IMPACT: 100% of the API was unavailable. All user requests failed.

TIMELINE:
  14:00 - Deployment web:v2.0.0 rolled out
  14:01 - Alert: Pods in CrashLoopBackOff
  14:03 - On-call engineer acknowledged
  14:05 - Identified missing ConfigMap "app-config-v2"
  14:08 - Created ConfigMap with correct values
  14:10 - Pods started successfully
  14:12 - Full service restored
  14:47 - Incident closed

ROOT CAUSE:
  The Deployment referenced a new ConfigMap "app-config-v2" that
  hadn't been created yet. All pods failed to start.

LESSONS LEARNED:
  1. ConfigMaps should be part of the same Helm chart as the Deployment.
  2. Readiness gates should prevent bad rollouts.
  3. CI should validate all resource references exist.

ACTION ITEMS:
  [ ] Include all ConfigMaps in the Helm chart (Owner: Platform, Due: 2024-01-16)
  [ ] Add CI validation for resource references (Owner: Platform, Due: 2024-01-20)
  [ ] Configure deployment gates (Owner: SRE, Due: 2024-01-22)

34. On-Call Runbook: Pod Won't Start

text
STEP 1: Identify the pod
  $ kubectl get pods -A | grep -v Running

STEP 2: Describe the pod
  $ kubectl describe pod <pod> -n <namespace>
  # Check the Events section

STEP 3: Check logs
  $ kubectl logs <pod> -n <namespace>
  $ kubectl logs <pod> -n <namespace> --previous

STEP 4: Categorize the issue

  CrashLoopBackOff → App is crashing
    - Check logs
    - Check exit code
    - Check ConfigMap/Secret refs

  ImagePullBackOff → Can't pull image
    - Check image name/tag
    - Check imagePullSecrets
    - Check registry auth

  Pending → Can't schedule
    - Check node resources
    - Check affinity/taints
    - Check PVC status

  ContainerCreating (stuck) → Volume or network issue
    - Check PVC/PV status
    - Check CNI

  CreateContainerConfigError → Bad config
    - Missing ConfigMap or Secret

STEP 5: Fix or escalate

35. Escalation Matrix

SeverityImpactResponse TimeEscalation
SEV-1Complete outage / all pods down5 minOn-call + Platform + Management
SEV-2Partial outage / degraded performance15 minOn-call + Platform
SEV-3Single service issue1 hourOn-call
SEV-4Config drift / warning4 hoursTicket

1:1 copy of the class Google Doc, code in code blocks.