Skip to content

Instantly share code, notes, and snippets.

@Fireforge
Created December 22, 2019 03:21
Show Gist options
  • Save Fireforge/82571dbfe193dfa6bbbed2c7e60a79bc to your computer and use it in GitHub Desktop.
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.
@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