Control plane components, QoS eviction classes, readiness/liveness probes, HPA math, and network policies.
Production SRE guide to Kubernetes scheduling, resource QoS classes, graceful pod termination lifecycle, Horizontal Pod Autoscaler (HPA) equations, and zero-downtime rolling deployments.
Scales pod replicas proportionally to the ratio of observed metric M_current to target M_target.
CPU is a compressible resource (throttled via CFS quota when exceeding `limits.cpu`), whereas Memory is incompressible (exceeding `limits.memory` triggers immediate kernel `OOMKilled` exit code 137).
| QoS Class | Configuration Rule | OOM Score Adj | Eviction Priority |
|---|---|---|---|
| Guaranteed | requests == limits for ALL containers (CPU & Mem) | -997 | Evicted LAST (protected) |
| Burstable | At least one container has requests < limits | 2 to 999 | Evicted second under node pressure |
| BestEffort | No requests or limits set on any container | 1000 | Evicted FIRST when node memory is low |
apiVersion: apps/v1
kind: Deployment
metadata:
name: paits-inference-gateway
spec:
replicas: 4
strategy:
type: RollingUpdate
rollingUpdate: { maxSurge: 1, maxUnavailable: 0 }
template:
spec:
terminationGracePeriodSeconds: 45
containers:
- name: api
resources:
requests: { cpu: '500m', memory: '1Gi' }
limits: { memory: '1Gi' }
readinessProbe:
httpGet: { path: /health/ready, port: 8000 }
periodSeconds: 5
lifecycle:
preStop:
exec:
command: ['/bin/sh', '-c', 'sleep 5']Strict CPU CFS quotas can cause artificial latency spikes on multi-threaded runtimes even when the host node has idle CPU cores available.