Skip to content

guessi/kubectl-grep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kubectl Grep

GitHub Actions GoDoc Go Report Card GitHub release GitHub go.mod Go version

Filter Kubernetes resources by matching their names

Compatibility

please refer to Kubernetes version policy and CHANGELOG for supported version matrix.

Why we need it?

playing with Kubernetes is my daily job, and I normally search pods by pipe, grep, --label, --field-selector, etc. while hunting abnormal pods, but typing such long commands is quite annoying.

Before change, we usually filter pods by the following commands,

$ kubectl get pods -n star-lab | grep "flash"

With this plugin installed, you can filter pod with kubectl grep easily

$ kubectl grep pods -n star-lab flash

Installation

Installation via krew

$ kubectl krew version # make sure you are running 0.4.4+
$ kubectl krew install grep
$ kubectl krew update
$ kubectl krew upgrade grep

Manual Installation

$ curl -fsSL -O https://github.com/guessi/kubectl-grep/releases/latest/download/kubectl-grep-$(uname -s)-$(uname -m).tar.gz
$ tar zxvf kubectl-grep-$(uname -s)-$(uname -m).tar.gz
$ mv kubectl-grep /usr/local/bin

How to get developer build?

$ go get -u github.com/guessi/kubectl-grep
$ cd ${GOPATH}/src/github.com/guessi/kubectl-grep
$ make all

FAQ

How do I check the tool's version?

  • kubectl grep version

Can I use version X kubectl with version Y kubectl-grep?

  • Sure, no problem

What kind of resource(s) kubectl-grep support?

Reference

License

Apache-2.0