<p>You should configure a <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes" rel="nofollow noreferrer">Readiness Probe</a> in the <code>Deployment</code> for your app. When using a <em>Readiness Probe</em>, no traffic will be sent to instances that are not prepared to receive traffic.</p>

CC BY-SA 4.0
2021-01-13T14:15:42.480Z
Readiness probe is configured and kicks in when we stop the pod gracefully and does not work as mentioned when the pod is killed because of an out of memory exception.
Sri Krishna
CC BY-SA 4.0
2021-01-13T14:29:22.727Z
@SriKrishna the pod is killed when you run out of memory, e.g. by setting resource limits. The Readiness Probe is run regularly, and you can adjust how often it is run, e.g. with `periodSeconds: 5` but you can lower that period if you want.
Jonas
CC BY-SA 4.0
2021-01-13T09:02:20.137Z
2021-01-13T09:02:20.137Z
Jonas
<p>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.</p>
<p>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.</p>

<docker><amazon-web-services><kubernetes><containers>
How to redirect the request to a different node when there is an unexpected exception and one of the pods gets restarted
Sri Krishna
# How to redirect the request to a different node when there is an unexpected exception and one of the pods gets restarted

(Asked by: username_0 on 2021-01-13)

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.

**Tags:** docker, amazon-web-services, kubernetes, containers


---

## 1 answers

### Answer by username_1 on 2021-01-13. Score: 1

You should configure a [Readiness Probe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes) in the `Deployment` for your app. When using a *Readiness Probe*, no traffic will be sent to instances that are not prepared to receive traffic.

> **Comments:**
> **username_0**: Readiness probe is configured and kicks in when we stop the pod gracefully and does not work as mentioned when the pod is killed because of an out of memory exception.  
> **username_1**: @SriKrishna the pod is killed when you run out of memory, e.g. by setting resource limits. The Readiness Probe is run regularly, and you can adjust how often it is run, e.g. with `periodSeconds: 5` but you can lower that period if you want.  

---

