https://github.com/guessi/kubectl-grep
Filter Kubernetes resources by matching their names
https://github.com/guessi/kubectl-grep
github-actions golang kubectl kubectl-plugins kubernetes
Last synced: 10 days ago
JSON representation
Filter Kubernetes resources by matching their names
- Host: GitHub
- URL: https://github.com/guessi/kubectl-grep
- Owner: guessi
- License: apache-2.0
- Created: 2019-02-12T17:25:18.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T02:19:35.000Z (about 1 month ago)
- Last Synced: 2025-03-29T11:05:59.652Z (17 days ago)
- Topics: github-actions, golang, kubectl, kubectl-plugins, kubernetes
- Language: Go
- Homepage:
- Size: 414 KB
- Stars: 117
- Watchers: 3
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-repositories - guessi/kubectl-grep - Filter Kubernetes resources by matching their names (Go)
- awesome-kubectl-plugins - kubectl-grep - grep)](https://github.com/guessi/kubectl-grep/stargazers) | (kubectl Plugins / Installing plugins via awesome-kubectl-plugins)
README
# Kubectl Grep
[](https://github.com/guessi/kubectl-grep/actions/workflows/go.yml)
[](https://godoc.org/github.com/guessi/kubectl-grep)
[](https://goreportcard.com/report/github.com/guessi/kubectl-grep)
[](https://github.com/guessi/kubectl-grep/releases/latest)
[](https://github.com/guessi/kubectl-grep/blob/main/go.mod)Filter Kubernetes resources by matching their names
## 🤔 Why we need this? what it is trying to resolve?
Playing with Kubernetes in our daily job, we normally search pods by `pipe`, `grep`, `--label`, `--field-selector`, etc. while hunting abnormal pods, but typing such long commands is quite annoying. With plugin installed, it could be easily be done by `kubectl grep`.
## 🔢 Prerequisites
* An existing Kubernetes cluster.
* Have [kubectl](https://kubernetes.io/docs/tasks/tools/) installed.
* Have [krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) installed.## 🚀 Quick start
```bash
# Have krew plugin installed
kubectl krew install grep
``````bash
# Before change, we usually filter pods by the following commands,
kubectl get pods -n star-lab | grep "flash"
``````bash
# With this plugin installed, you can filter pod easily
kubectl grep pods -n star-lab flash
```## :accessibility: FAQ
How do I check the version installed?
* `kubectl grep version`
How do I know the version installed is compatible with my cluster version?
* Ideally, it should be compatible with [supported Kubernetes versions](https://kubernetes.io/releases/).
What kind of resource(s) `kubectl-grep` support?
* Please refer to [Resource Types](RESOURCE_TYPES.md)
## 👷 Install
### Recommended way
```bash
kubectl krew install grep && kubectl krew update && kubectl krew upgrade grep
```### Manual Installation
Click to expand!
```bash
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
```### Developer build
Click to expand!
```bash
go get -u github.com/guessi/kubectl-grep
cd ${GOPATH}/src/github.com/guessi/kubectl-grep
make all
```## ⚖️ License
[Apache-2.0](LICENSE)