django-probes icon indicating copy to clipboard operation
django-probes copied to clipboard

Add middleware or similar for Kubernetes probes

Open bittner opened this issue 5 years ago • 0 comments

As of today, this Django app only provides a way to ensure that a database, configured in your Django project, is reachable. The main use case for this is a Kubernetes Init Container.

Health checks

For the health checks after the startup phase, we usually suggest to implement the Kubernetes probes with the least impact that technically makes sense. For Python application running uWSGI this is a check on the socket, e.g.

      containers:
      - name: django
        ports:
        - name: uwsgi
          containerPort: 8000
        livenessProbe:
          tcpSocket:
            port: uwsgi
          initialDelaySeconds: 13
        readinessProbe:
          tcpSocket:
            port: uwsgi
          initialDelaySeconds: 9

However, if someone for some specific reason wanted to do checks deeper into the Django application stack we may need to provide an appropriate way to call the application in a way that consumes few resources. (A management command will probably not do for this use case.)

Other background reading

bittner avatar Oct 13 '20 21:10 bittner