A tool to easily operate on multiple pods at the same time!
Report Bug
·
Request Feature
In my day to day job i often need to debug pods in a kubernetes cluster or need to get logs from all of them. However, with the default tools, provided by kubernetes, it's super hard and time consuming to do it. This is why I decided to build a small helper tool in order to keep us productive and less annoyed.
I've tried to solve the following problems:
- Get Logs from multiple containers in one stream
- Execute a command in multiple pods
- Follow Logs of multiple pods (WIP)
- Exec into multiple pods with an interactive shell (WIP)
- A functional Kubernetes cluster (tested with >= 1.17)
- Golang >= 1.15
- pre-commit >= 2.0
You can install the tool via Homebrew and the tap repository can be found here.
brew install dhenkel92/tap/pod-helper
In order to get a newer version, just upgrade via Homebrew
brew upgrade dhenkel92/tap/pod-helper
See the Releases page for a list of Peek packages for various distributions.
Use different .kubeconfig file than ~/.kube/config
pod-helper --kubeconfig /kube/config logs
or short
pod-helper -config /kube/config logs
By default, the pod-helper is executing the command against five containers in parallel. This can be updated in the following way
pod-helper --batch-size 10 logs
or short
pod-helper -b 10 logs
Run ls -al
in all pods of the default namespace
pod-helper --namespace default run --command "ls -al"
or short
pod-helper -n default run -c "ls -al"
Run ls -al
in all the pods
pod-helper run --comand "ls -al"
or short
pod-helper run -c "ls -al"
Override the entrypoint for the command execution (default /bin/sh -c
)
pod-helper run --entrypoint "/bin/bash -c" --comand "ls -al"
or short
pod-helper run -e "/bin/bash -c" -c "ls -al"
Select pod by label selector in default namespace
pod-helper --namespace default --label app=nginx run --command "ls -al"
or short
pod-helper -n default -l app=nginx run --command "ls -al"
Run a command on all the pods in the namespace default and kube-system
pod-helper --namespace default --namespace kube-system --label app=nginx run --command "ls -al"
or short
pod-helper -n default -n kube-system -l app=nginx run --command "ls -al"
Get all logs from all the pods in the cluster
pod-helper logs
or short
pod-helper logs
Get all logs from all pods in the kube-system namespace
pod-helper --namespace kube-system logs
or short
pod-helper -n kube-system logs
Get the last ten log entries of all the pods
pod-helper logs --tail 10
or short
pod-helper logs -t 10
Get logs of the first container in all pods in the cluster
pod-helper --container-index 0 logs
or short
pod-helper -ci 0 logs
Get logs of containers mit name nginx
.
pod-helper --container nginx logs
or short
pod-helper -con nginx logs
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/amazing_feature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/amazing_feature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Daniel Henkel - [email protected]
Project Link: https://github.com/dhenkel92/pod-helper