Stage 5, Part 7 of 9, Scheduling Deep Dive

Text

PART 7: INCIDENT MANAGEMENT

36. Scheduling Incident Post-Mortem Template

text
INCIDENT: Mass Pending Pods - Cluster Outage
DATE: 2024-01-15
DURATION: 45 minutes
SEVERITY: SEV-1
IMPACT: New deployment Pods stuck in Pending. Rollout stalled.

TIMELINE:
  14:00 - New deployment rolled out
  14:01 - Alert: Pods Pending > 5 minutes
  14:03 - On-call acknowledged
  14:05 - Identified: all new Pods Pending with "Insufficient cpu"
  14:08 - Checked nodes: no node had 2 CPUs free
  14:10 - New Pods were requesting 2 CPUs but using 100m
  14:15 - Fixed resource requests to 200m
  14:20 - Rollout resumed
  14:45 - All Pods running

ROOT CAUSE:
  Over-requested CPU (2 cores) for pods that needed 200m.
  Cluster had capacity but not as a single contiguous 2-core block.

LESSONS LEARNED:
  1. Over-requesting wastes cluster capacity.
  2. CI should warn on over-requesting.
  3. VPA should be used for recommendations.

ACTION ITEMS:
  [ ] Deploy VPA to all workloads (Owner: Platform, Due: 2024-01-20)
  [ ] Add CI check for over-requesting (Owner: Platform, Due: 2024-01-22)
  [ ] Training on resource sizing (Owner: Team, Due: 2024-01-25)

37. On-Call Runbook: Pending Pods

text
SYMPTOM: Pods stuck in Pending.

STEP 1: Confirm
  $ kubectl get pods -A | grep Pending

STEP 2: Get the reason
  $ kubectl describe pod <pod> | grep -A10 Events

STEP 3: Categorize the reason

  "Insufficient cpu/memory":
    $ kubectl describe nodes | grep -A5 "Allocated resources"
    - Add capacity OR reduce requests

  "Taint not tolerated":
    $ kubectl describe node <node> | grep Taints
    - Add toleration OR remove taint

  "Node selector mismatch":
    $ kubectl get nodes --show-labels
    - Fix selector OR add label

  "Affinity mismatch":
    $ kubectl get pods -l <selector>
    - Relax to preferred OR add node

  "Unbound PVC":
    $ kubectl get pvc
    - Fix PVC or StorageClass

  "Unschedulable nodes":
    $ kubectl get nodes
    - Uncordon

STEP 4: Check scheduler health
  $ kubectl get pods -n kube-system -l component=kube-scheduler
  $ kubectl logs -n kube-system -l component=kube-scheduler --tail=100

STEP 5: Apply fix

STEP 6: Escalate if unresolved

38. Escalation Matrix

SeverityImpactResponse TimeEscalation
SEV-1All new Pods Pending / scheduler down5 minOn-call + Platform + Management
SEV-2Specific workload stuck Pending15 minOn-call + Platform
SEV-3Slow scheduling1 hourOn-call
SEV-4Configuration warning4 hoursTicket

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