kubectl-knife is a tool to run commands on multiple pods concurrently using kubectl commands
kubectl krew install knife
More info: https://krew.sigs.k8s.io/plugins/
https://github.com/spideyz0r/kubectl-knife/releases
git checkout https://github.com/spideyz0r/kubectl-knife
cd kubectl-knife; go build -v -o kubectl-knife
Usage: kubectl knife [-dhs] [-C value] [-c value] [-m value] [-n value] [-p value] [-S value] [parameters ...]
-C, --command=value
command to run, if empty, just list pods
-c, --context=value
context regex
-d, --debug debug mode
-h, --help display this help
-m, --max-concurrency=value
max concurrency, default: 10
-n, --namespace=value
namespace regex
-p, --pod=value pod regex
-S, --shell=value default: sh
-s, --skip-filter skip filtering, does not use regex
1 Download or compile the binary
2 Rename it to kubectl-knife
3 Make sure the binary is included in your $PATH
$ kubectl knife -h
Usage: kubectl-knife [-dhs] [-C value] [-c value] [-m value] [-n value] [-p value] [-S value] [parameters ...]
-C, --command=value
command to run, if empty, just list pods
-c, --context=value
context regex
-d, --debug debug mode
-h, --help display this help
-m, --max-concurrency=value
max concurrency, default: 10
-n, --namespace=value
namespace regex
-p, --pod=value pod regex
-S, --shell=value default: sh
-s, --skip-filter skip filtering, does not use regex
- Improve pod listing output, and make it more useful
- Dynamically tries /bin/sh, /bin/dash, /bin/bash, /bin/ash ===> sh -c "ls -d /tmp" || bash -c "ls -d /tmp" || ash -c "ls -d /tmp" || dash -c "ls -d /tmp"
- Configure timeout for API calls via go context