<p>I have a flask app with uwsgi and gevent.<br>
Here is my <code>app.ini</code>
How could I write readinessProbe and livenessProbe on kubernetes to check to flask app?</p>

<pre><code>[uwsgi]
socket = /tmp/uwsgi.sock
chdir = /usr/src/app/
chmod-socket = 666
module = flasky
callable = app
master = false
processes = 1
vacuum = true
die-on-term = true
gevent = 1000
listen = 1024
</code></pre>

Rukeith
<p>You can configure <code>uWSGI</code> to serve both <code>uwsgi-socket</code> along side <code>http-socket</code>, and only expose the <code>uwsgi-socket</code> to the <code>k8s service</code>. </p>

<p>In this case your <code>uwsgi.ini</code> would looks something like:</p>

<pre><code>[uwsgi]
socket = /tmp/uwsgi.sock
chdir = /usr/src/app/
chmod-socket = 666
module = flasky
callable = app
master = false
processes = 1
vacuum = true
die-on-term = true
gevent = 1000
listen = 1024

http-socket = 0.0.0.0:5050
</code></pre>

<p>And assuming you have <code>/health</code> endpoint in your app, your <code>k8s manifest</code> can be something like:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-exec
spec:
  containers:
  - name: myapp
    image: myimage
    livenessProbe:
      httpGet:
        path: /health
        port: 5050
        httpHeaders:
        - name: Custom-Header
          value: Awesome
      initialDelaySeconds: 5
      periodSeconds: 5
</code></pre>

<p>In this case, your service will be reachable sitting as the upstream at <code>socket = /tmp/uwsgi.sock</code> via your <code>k8s service</code> and the <code>k8s healthcheck</code> service can reach your container at <code>http-socket: 5050</code>. </p>
