# Configuring liveness and readiness probes for Kubernetes Deployment

**URL:** <https://discuss.openedx.org/t/configuring-liveness-and-readiness-probes-for-kubernetes-deployment/14186>\
**Category:** Site Operators\
**Tags:** tutor, k8s, palm\
**Created:** [October 18, 2024, 3:58pm UTC](https://discuss.openedx.org/t/configuring-liveness-and-readiness-probes-for-kubernetes-deployment/14186 "2024-10-18T15:58:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wnnlyy](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wnnlyy](https://discuss.openedx.org/u/wnnlyy)\
**Post date:** [October 18, 2024, 3:58pm UTC](https://discuss.openedx.org/t/configuring-liveness-and-readiness-probes-for-kubernetes-deployment/14186/1 "2024-10-18T15:58:50Z")

</div>

Hello, just wondering if anyone has tried configuring liveness and readiness probes for Kubernetes Deployment?

I noticed that when I run the following command from the **LMS** or **CMS** pods:

```auto
curl -I http://localhost:8000/heartbeat

```

I get a **400 status code** error.

Here’s my initial configuration:

```auto
          # Liveness Probe (check if the service is alive)
          livenessProbe:
            httpGet:
              path: /heartbeat
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3
          # Readiness Probe (check if the service is ready to receive traffic)
          readinessProbe:
            httpGet:
              path: /heartbeat
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            failureThreshold: 3

```

Any advise will be appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![MoisesGonzalezS](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/moisesgonzalezs/32/1996_2.png) [@MoisesGonzalezS](https://discuss.openedx.org/u/MoisesGonzalezS)\
**Post date:** [October 18, 2024, 4:44pm UTC](https://discuss.openedx.org/t/configuring-liveness-and-readiness-probes-for-kubernetes-deployment/14186/2 "2024-10-18T16:44:48Z")

</div>

The 400 error is because the [`ALLOWED_HOSTS`](https://github.com/overhangio/tutor/blob/9e5a87bea7a445b4c993fd11a13d03a6670700be/tutor/templates/apps/openedx/settings/lms/production.py#L7-L10) forbids requests using localhost as a hostname. You should include the header `Host: lms` or `Host: cms`

You can add the header to the probe:

```yaml
          livenessProbe:
            httpGet:
              httpHeaders:
                - name: Host
                  value: lms
              path: /heartbeat
              port: 8000

```

Or you can edit your `ALLOWED_HOSTS` setting.

---

<div class="post-metadata">

**Author:** ![wnnlyy](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@wnnlyy](https://discuss.openedx.org/u/wnnlyy)\
**Post date:** [October 19, 2024, 9:58am UTC](https://discuss.openedx.org/t/configuring-liveness-and-readiness-probes-for-kubernetes-deployment/14186/3 "2024-10-19T09:58:25Z")

</div>

Thanks! That was helpful.
