We are deploying the application in a Kubernetes cluster and when we face an unexpected error and the pod gets restarted or goes down we are getting a 502 Gateway error even though there is another pod that should start accepting the requests without getting the 502 gateway error.
We are making sure that the application is cluster enabled and the request is redirected to the another pod automatically when we stop/kill the pod gracefully but doesnot happen on a exception.