Skip to content

Instantly share code, notes, and snippets.

@stuart-warren
Last active June 14, 2017 07:41
Show Gist options
  • Save stuart-warren/491425983f79d50cd8778c320f093d70 to your computer and use it in GitHub Desktop.
Save stuart-warren/491425983f79d50cd8778c320f093d70 to your computer and use it in GitHub Desktop.
Check kubernetes api server from inside a pod
#!/usr/bin/env bash
/usr/bin/curl -sf -H "Authorization: Bearer $(</var/run/secrets/kubernetes.io/serviceaccount/token)" \
--cacert "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" \
"https://${KUBERNETES_PORT_443_TCP_ADDR}/version"
# OR
/usr/bin/nc -w3 -z ${KUBERNETES_SERVICE_HOST} ${KUBERNETES_SERVICE_PORT}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment