Last active
June 12, 2020 22:32
-
-
Save tomotake-koike/e12c392447d1254b8d438fe5041ec4f4 to your computer and use it in GitHub Desktop.
Liveness/ReadinessProbe Http Health-check Python Script for a container without curl
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
| oc create configmap hc-script --from-file <( cat << EOF | |
| import urllib.request | |
| import sys | |
| request = urllib.request.Request("http://127.0.0.1:" + sys.argv[1] ) | |
| try: | |
| with urllib.request.urlopen(request, timeout=3) as response: | |
| body = response.read() | |
| print(body) | |
| except Exception as e: | |
| print( e ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment