<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>I think what you are really asking is "How to health check a uWSGI application". There are some example tools to do this. Particularly:</p>

<ul>
<li><a href="https://github.com/andreif/uwsgi-tools" rel="nofollow noreferrer">https://github.com/andreif/uwsgi-tools</a></li>
<li><a href="https://github.com/che0/uwping" rel="nofollow noreferrer">https://github.com/che0/uwping</a></li>
<li><a href="https://github.com/m-messiah/uwget" rel="nofollow noreferrer">https://github.com/m-messiah/uwget</a></li>
</ul>

<p>The <code>uwsgi-tools</code> project seems to have the most complete example at <a href="https://github.com/andreif/uwsgi-tools/issues/2#issuecomment-345195583" rel="nofollow noreferrer">https://github.com/andreif/uwsgi-tools/issues/2#issuecomment-345195583</a>. In a Kubernetes Pod spec context this might end up looking like:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-exec
spec:
  containers:
  - name: myapp
    image: myimage
    livenessProbe:
      exec:
        command:
        - uwsgi_curl
        - -H
        - Host:host.name
        - /path/to/unix/socket
        - /health
      initialDelaySeconds: 5
      periodSeconds: 5
</code></pre>

<p>This would also assume your application responded to <code>/health</code> as a health endpoint.</p>
