I use kubectl exec -it
for logging into a single Kubernetes pod.
Is there any way to log in to multiple pods in a cluster, at the same time with a single command (just like csshX
)?
There is a plugin that could help you with this. It's called kubectl-tmux-exec:
A kubectl plugin that controls multiple pods simultaneously using Tmux.
It is to
kubectl exec
ascsshX
orpssh
is tossh
.Instead of exec bash into multiple pod's containers one-at-a-time, like
kubectl exec pod{N} /bin/bash
.You can now use
kubectl tmux-exec -l app=nginx /bin/bash
All necessary details regarding Installation and Usage can be found in the linked docs.