Created
December 22, 2019 03:21
-
-
Save Fireforge/82571dbfe193dfa6bbbed2c7e60a79bc to your computer and use it in GitHub Desktop.
Liveness and readiness checks for Flask running in a container. Useful when running flask in a Kubernetes environment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/healthz/live', methods=['GET']) | |
def healthz_live(): | |
return 'ok\n' | |
@app.route('/healthz/ready', methods=['GET']) | |
def healthz_ready(): | |
if ready: | |
return 'ok\n' | |
else: | |
return 'not ready\n', 503 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment