I have a flask app with uwsgi and gevent.
Here is my app.ini
How could I write readinessProbe and livenessProbe on kubernetes to check to flask app?
[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
I think what you are really asking is "How to health check a uWSGI application". There are some example tools to do this. Particularly:
The uwsgi-tools project seems to have the most complete example at https://github.com/andreif/uwsgi-tools/issues/2#issuecomment-345195583. In a Kubernetes Pod spec context this might end up looking like:
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
This would also assume your application responded to /health as a health endpoint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With