I am using SpringBoot in my REST services and I needed to set the spring property server.shutdown=graceful
. I left the management of pod shutdown with K8s default behavior.
How to avoid terminate issues on AKS when scaling in
I have an internal service (rest APIs) in AKS with HPA configured to it. It works fine when it needs to scale-out to handle a higher traffic period. Although when AKS understands that it can scale-in I start having issues. I got a lot of 503 errors in the clients, even after the pod starts its termination process the pod continues receiving requests.
I found a very similar 2-years-age issue with ingress: https://github.com/Azure/application-gateway-kubernetes-ingress/issues/641
Anyone else with the same issue? Anyone with an idea on how to solve it?
Azure Kubernetes Service
-
Mesquita, Walter 96 Reputation points
2021-06-07T11:45:59.293+00:00
1 additional answer
Sort by: Most helpful
-
prmanhas-MSFT 17,946 Reputation points Microsoft Employee Moderator
2021-05-17T07:17:03.24+00:00 @Mesquita, Walter Apologies for the delay in response and all the inconvenience caused because of the issue.
The mentioned Git issue has explained the solution well. This comment has explained it in details.
The key here is preStop hook and terminationGracePeriodSeconds. With Kubernetes v1.21, a probe level terminationGracePeriodSeconds has also been introduced in alpha as mentioned here.You can read more about it here.
Hope it helps!!!
Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.