Skip to content

Instantly share code, notes, and snippets.

@tomotake-koike
Last active June 12, 2020 22:32
Show Gist options
  • Select an option

  • Save tomotake-koike/e12c392447d1254b8d438fe5041ec4f4 to your computer and use it in GitHub Desktop.

Select an option

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
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