Skip to content

Tool to easily operate on multiple pods at the same time.

License

Notifications You must be signed in to change notification settings

dhenkel92/pod-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Main Release


Kubernetes Pod Helper

A tool to easily operate on multiple pods at the same time!

Report Bug · Request Feature

Table of Contents

About The Project

Product Name Screen Shot

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)

Prerequisites

Runtime

  • A functional Kubernetes cluster (tested with >= 1.17)

Development

Installation

MacOS

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

Other distributions

See the Releases page for a list of Peek packages for various distributions.

Usage

General

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

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"

Logs

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

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/amazing_feature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/amazing_feature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Daniel Henkel - [email protected]

Project Link: https://github.com/dhenkel92/pod-helper

Acknowledgements

About

Tool to easily operate on multiple pods at the same time.

Resources

License

Stars

Watchers

Forks

Packages

No packages published