diff --git a/README.md b/README.md index 5ca7a8e..a5ca948 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,9 @@ kubectl node-shell --image # Use X-mode (mount /host, and do not enter host namespace) kubectl node-shell -x +# Skip specific namespace types to enter, choose any of ipc, mount, pid, net, uts +kubectl node-shell --no-ipc + # Execute custom command kubectl node-shell -- echo 123 diff --git a/kubectl-node_shell b/kubectl-node_shell index 1ce2983..5c24304 100755 --- a/kubectl-node_shell +++ b/kubectl-node_shell @@ -15,6 +15,11 @@ x_mode=0 labels="${KUBECTL_NODE_SHELL_LABELS}" pod_running_timeout="${KUBECTL_NODE_SHELL_POD_RUNNING_TIMEOUT:-1m}" custom_image="" +use_ipc=true +use_mount=true +use_pid=true +use_net=true +use_uts=true if [ -t 0 ]; then tty=true @@ -71,6 +76,26 @@ while [ $# -gt 0 ]; do shift shift ;; + --no-ipc) + use_ipc=false + shift + ;; + --no-mount) + use_mount=false + shift + ;; + --no-pid) + use_pid=false + shift + ;; + --no-net) + use_net=false + shift + ;; + --no-uts) + use_uts=false + shift + ;; --) shift break @@ -116,7 +141,24 @@ else # If the OS isn't windows, assume linux image="${custom_image:-${KUBECTL_NODE_SHELL_IMAGE:-$default_image}}" name="nsenter" pod="${name}-$(env LC_ALL=C tr -dc a-z0-9