3 ms·
This is why we inject `preStop: ["/bin/sleep", "30"]` in every kubernetes PodSpec via an admission controller. Kubernetes service/ingress are designed to be ev
by rdsubhas 5y ago
This is why we inject `preStop: ["/bin/sleep", "30"]` in every kubernetes PodSpec via an admission controller.
Kubernetes service/ingress are designed to be event-driven and eventually consistent. For example, the nginx ingress controller has a direct list of Pod IPs as backends, and will remove them asynchronously based on receiving pod lifecycle events. In real life, it means the pod will be shutdown long before the endpoint is actually removed, leading to error rates. The preStop hook is necessary to avoid request failures, at the expense of longer pod shutdown.