Opscraft
Kubernetes troubleshooting · Lesson 5 of 11 · 3 min read

Resources and performance

CPU throttling

Symptom: latency spikes, slow responses, even though average CPU usage looks low. Cause: CPU limits are enforced as CFS quota per 100 ms period; a multi-threaded burst (GC, JIT, a batch of requests) exhausts the quota early and the container is paused for the rest of the period.

container_cpu_cfs_throttled_periods_total / container_cpu_cfs_periods_total   → throttling ratio

Fixes: raise or remove CPU limits for latency-sensitive services (keep realistic requests for fair sharing and scheduling), tune thread pools/GC threads to the CPU allotment.

Enlarge diagramrunsidle100 ms period 1runsthrottled100 ms period 2runsthrottled100 ms period 3runsidle100 ms period 4Fix: realistic requests; remove or raise CPU limits for latency-sensitive services.
Figure 1. CPU throttling: a limit of 0.5 CPU means 50 ms of CPU time per 100 ms. A burst uses it up early and the container waits, even if the node is idle.
Swipe sideways to see all of it, or tap to open it full screen.

Evictions

Pods with status Evicted (reason in describe): the kubelet evicted them due to node pressure — memory, ephemeral storage (ephemeral-storage used by logs/emptyDir/container layers), PIDs. BestEffort pods go first, then Burstable pods over their requests. Fix the pressure source (set ephemeral-storage requests/limits, log rotation, memory requests realistic), and clean up evicted pod objects (kubectl delete pod --field-selector=status.phase=Failed -n shop).

HPA not scaling

kubectl get hpa -n shop
kubectl describe hpa orders -n shop
  • TARGETS <unknown>/70% → metrics-server missing/broken, or pods have no CPU requests (utilisation is computed relative to requests).
  • ScalingLimited / at maxReplicas → raise maxReplicas (and check node capacity).
  • Custom metrics not found → Prometheus Adapter/KEDA configuration.
  • Flapping → tune behavior stabilisation windows.
Enlarge diagrammetrics-serverinstalled and healthy?CPU requestsset on everycontainer?maxReplicasalready at the max?Node capacitynew pods Pending?1234
Figure 2. Why an HPA shows <unknown>: it needs metrics-server, and pod CPU requests to compute a percentage.
Swipe sideways to see all of it, or tap to open it full screen.

Noisy neighbours

Prevent with: requests/limits on everything (enforced by LimitRange and policy), ResourceQuotas per namespace, PriorityClasses for critical workloads, separate node pools (taints) for heavy or special workloads, and topology spread.