Filter Kubernetes resources by matching their names
please refer to Kubernetes version policy and CHANGELOG for supported version matrix.
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 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
$ go get -u github.com/guessi/kubectl-grep
$ cd ${GOPATH}/src/github.com/guessi/kubectl-grep
$ make all
How do I check the tool's version?
kubectl grep version
Can I use version X kubectl
with version Y kubectl-grep
?
What kind of resource(s) kubectl-grep
support?