Interview Prep/SRE & Reliability/Release Engineering & Reliability Patterns

How do readiness probes and graceful shutdown contribute to release reliability on Kubernetes?

AdvancedConceptRelease Engineering & Reliability Patterns
Answer
  • Readiness probes keep a pod out of Service endpoints until it can serve, so rolling updates do not send traffic to pods still starting.
  • Graceful shutdown: on termination Kubernetes sends SIGTERM; the app should stop accepting new work, finish in-flight requests and exit within terminationGracePeriodSeconds.
  • A preStop sleep of a few seconds covers the delay before endpoint removal propagates to kube-proxy and ingress controllers.
lifecycle:
  preStop:
    exec: {command: ["sleep", "10"]}
terminationGracePeriodSeconds: 40

Together with maxUnavailable: 0 and a PodDisruptionBudget, deploys and node drains cause zero errors.

All SRE & Reliability questions

More on Release Engineering & Reliability Patterns