Skip to content

verticaio/kubectl-run_shell_all_node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

kubeclt-run_shell_all_node, run shell commands all kubernetes nodes as kubectl plugin

➜  ~ export   KUBECONFIG=~/.kube/config
➜  ~ chmod +x kubectl-run_shell_all_node kubectl-run_shell_single_node
➜  ~ cp kubectl-run_shell_all_node kubectl-run_shell_single_node /usr/local/bin/

➜  ~ kubectl plugin list
The following compatible plugins are available:
/usr/local/bin/kubectl-cmd
/usr/local/bin/kubectl-run_shell_all_node
/usr/local/bin/kubectl-run_shell_single_node

➜  ~ kubectl get nodes
NAME       STATUS   ROLES    AGE    VERSION
master01   Ready    master   108d   v1.13.5
worker01   Ready    node     108d   v1.13.5
worker02   Ready    node     108d   v1.13.5

➜  ~ kubectl run_shell_all_node echo "Hello World"
executing command  on "master01"
Hello World

executing command  on "worker01"
Hello World

executing command  on "worker02"
Hello World

➜  ~ kubectl run_shell_all_node nc -zv localhost 22
executing command  on "master01"
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.1:22.
Ncat: 0 bytes sent, 0 bytes received in 0.01 seconds.

executing command  on "worker01"
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.1:22.
Ncat: 0 bytes sent, 0 bytes received in 0.02 seconds.

executing command  on "worker02"
Ncat: Version 7.50 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.1:22.
Ncat: 0 bytes sent, 0 bytes received in 0.02 seconds.

Execute command in single k8s node
➜ ~ kubectl run_shell_single_node worker01
executing command  on "worker01"
If you don't see a command prompt, try pressing enter.
[root@worker01 /]# 
[root@worker01 /]# hostname
worker01
[root@worker01 /]# exit
logout

Execute command in single k8s node as argument
➜  ~ kubectl run_shell_single_node worker01 -- hostname
executing command  on "worker01"
worker01

Resources

youtube_tutorial
awesome-kubectl-plugins
alexeiled_nsenter_docker
sample_example

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages