Created
January 6, 2020 09:24
-
-
Save chendotjs/e51bb5cf47937165cc55788347dfc73c to your computer and use it in GitHub Desktop.
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
function e() { | |
set -eu | |
ns=${2-"default"} | |
pod=`kubectl -n $ns describe pod $1 | grep -A10 "^Containers:" | grep -Eo 'docker://.*$' | head -n 1 | sed 's/docker:\/\/\(.*\)$/\1/'` | |
pid=`docker inspect -f {{.State.Pid}} $pod` | |
echo "entering pod netns for $ns/$1" | |
cmd="nsenter -n --target $pid" | |
echo $cmd | |
$cmd | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment