Created
February 19, 2015 15:04
-
-
Save mattf/5f96a9cba41147a82bec to your computer and use it in GitHub Desktop.
fake hostname for running kubelet with asymmetric name resolution
This file contains 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/sh | |
# mv /bin/hostname /bin/hostname.real | |
# install $0 as /bin/hostname (a+rx) | |
TARGET="kubelet" | |
IFACE=eth0 | |
PARENT=$(ps -oucmd= $PPID) | |
if [ "$PARENT" = "$TARGET" ]; then | |
IP=$(ip addr show dev $IFACE | grep 'inet ' | sed 's,.*inet \(.*\)/.*,\1,') | |
echo $IP | |
else | |
exec hostname.real $* | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment