What is the alternative of csshX for Kubernetes Pods?

5/27/2021

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)?

-- Sushovan Mishra
kubectl
kubernetes
ssh

1 Answer

5/27/2021

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 as csshX or pssh is to ssh.

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.

-- WytrzymaƂy Wiktor
Source: StackOverflow