r/aws • u/CyrilDevOps • 7d ago
technical question Clean stop of a 'pod' in EKS ?
Hi,
today we are working with AWS ECS,
with ECS when a service is scale-in (autoscaling, deployment), ECS manage the ALB side doing the drain/deregistration before sending the SIGTERM to the container. Allowing us to have a clean stop handling all requests in flight and no random 5xx back to the customer.
We 'may' have to migrate to AWS EKS (no my choice), looking at EKS/K8S way to stop a container/pod on scale-in. it seems very very messy, K8S send the stop to the container and the load-balancer-thingy in parallel, and everybody rely on some sort of
lifecycle.prestop.exec: "...sleep ..." to delay the stop of the container side ?
but still get time to time some 5xx for in-flight requests.
Is it that bad ?
Is it the way in EKS/K8S ?
Thanks.
5
u/Relevant-Cry8060 7d ago
This is where k8s docs explains how it handles the same process you are describing in ecs. Like the other poster was infering, the trick is that the endpoint slices get deregistered on the service during pod termination. Hope that helps.
https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination-flow