Created
August 31, 2015 13:20
-
-
Save iocanel/41f2923a9cbddb6d509d to your computer and use it in GitHub Desktop.
Get the docker host ip inside Kubernetes
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
#!/bin/bash | |
KUBERNETES=https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_SERVICE_PORT | |
TOKEN=`cat /var/run/secrets/kubernetes.io/serviceaccount/token` | |
POD=`hostname` | |
curl -s -k -H "Authorization: Bearer $TOKEN" $KUBERNETES/api/v1/namespaces/$KUBERNETES_NAMESPACE/pods/$POD | grep -i hostIp | cut -d "\"" -f 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment