yasi123 / kubectl-node-shell

Exec into node via kubectl

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kubectl node-shell

(formerly known as kubectl-enter)

Start a root shell in the node's host OS running.



using krew:

kubectl krew index add kvaps https://github.com/kvaps/krew-index
kubectl krew install kvaps/node-shell

or using curl:

curl -LO https://github.com/kvaps/kubectl-node-shell/raw/master/kubectl-node_shell
chmod +x ./kubectl-node_shell
sudo mv ./kubectl-node_shell /usr/local/bin/kubectl-node_shell


# Get standard bash shell
kubectl node-shell <node>

# Execute custom command
kubectl node-shell <node> -- echo 123

# Use stdin
cat /etc/passwd | kubectl node-shell <node> -- sh -c 'cat > /tmp/passwd'

# Run oneliner script
kubectl node-shell <node> -- sh -c 'cat /tmp/passwd; rm -f /tmp/passwd'

You need to be able to start privileged containers for that.


Exec into node via kubectl

License:Apache License 2.0


Language:Shell 100.0%