kubectl-grep

command module
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

Kubectl Grep

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

Filter Kubernetes resources by matching their names

Requirements

  • Kubernetes 1.24.0+
  • Kubectl 1.24.0+
  • Krew 0.4.3+

Compatibility

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

Example: kubectl-grep build with Kubernetes-1.24.x should be compatable with Kubernetes cluster version 1.24, 1.25, 1.26.

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.3+
$ 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL