ungleich-tools/k8s/pssh-all-nodes.sh
2021-12-11 00:02:45 +01:00

13 lines
325 B
Bash
Executable file

#!/bin/sh
# Execute commands on all hosts of the currently selected kubernetes cluster
# Do export KUBECONFIG=~/your-admin.conf before using this script
#set -x
domain=$1; shift
tmp=$(mktemp)
kubectl get node -o name | sed -e 's,node/,,' -e "s,\$,.$domain,"> "$tmp"
#cat "$tmp"
pssh -h "$tmp" -l root -i "$@"
rm -f "$tmp"