|
8 | 8 |
|
9 | 9 | Filter Kubernetes resources by matching their names |
10 | 10 |
|
11 | | -# Compatibility |
| 11 | +## 🤔 Why we need this? what it is trying to resolve? |
12 | 12 |
|
13 | | -please refer to [Kubernetes version policy](https://kubernetes.io/docs/setup/release/version-skew-policy/#kubectl) and [CHANGELOG](CHANGELOG.md) for supported version matrix. |
| 13 | +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`. |
14 | 14 |
|
15 | | -# Why we need it? |
| 15 | +## 🔢 Prerequisites |
16 | 16 |
|
17 | | -playing with Kubernetes is my daily job, and I normally search pods by `pipe`, |
18 | | -`grep`, `--label`, `--field-selector`, etc. while hunting abnormal pods, but |
19 | | -typing such long commands is quite annoying. |
| 17 | +* An existing Kubernetes cluster. |
| 18 | +* Have [kubectl](https://kubernetes.io/docs/tasks/tools/) installed. |
| 19 | +* Have [krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) installed. |
20 | 20 |
|
21 | | -Before change, we usually filter pods by the following commands, |
| 21 | +## 🚀 Quick start |
22 | 22 |
|
23 | | - $ kubectl get pods -n star-lab | grep "flash" |
| 23 | +```bash |
| 24 | +# Have krew plugin installed |
| 25 | +kubectl krew install grep |
| 26 | +``` |
24 | 27 |
|
25 | | -With this plugin installed, you can filter pod with `kubectl grep` easily |
| 28 | +```bash |
| 29 | +# Before change, we usually filter pods by the following commands, |
| 30 | +kubectl get pods -n star-lab | grep "flash" |
| 31 | +``` |
26 | 32 |
|
27 | | - $ kubectl grep pods -n star-lab flash |
| 33 | +```bash |
| 34 | +# With this plugin installed, you can filter pod easily |
| 35 | +kubectl grep pods -n star-lab flash |
| 36 | +``` |
28 | 37 |
|
29 | | -# Installation |
| 38 | +## :accessibility: FAQ |
30 | 39 |
|
31 | | -Installation via [krew](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) |
32 | | - |
33 | | - $ kubectl krew version # make sure you are running 0.4.4+ |
34 | | - $ kubectl krew install grep |
35 | | - $ kubectl krew update |
36 | | - $ kubectl krew upgrade grep |
37 | | - |
38 | | -Manual Installation |
39 | | - |
40 | | - $ curl -fsSL -O https://github.com/guessi/kubectl-grep/releases/latest/download/kubectl-grep-$(uname -s)-$(uname -m).tar.gz |
41 | | - $ tar zxvf kubectl-grep-$(uname -s)-$(uname -m).tar.gz |
42 | | - $ mv kubectl-grep /usr/local/bin |
43 | | - |
44 | | -# How to get developer build? |
45 | | - |
46 | | - $ go get -u github.com/guessi/kubectl-grep |
47 | | - $ cd ${GOPATH}/src/github.com/guessi/kubectl-grep |
48 | | - $ make all |
49 | | - |
50 | | -# FAQ |
51 | | - |
52 | | -How do I check the tool's version? |
| 40 | +How do I check the version installed? |
53 | 41 |
|
54 | 42 | * `kubectl grep version` |
55 | 43 |
|
56 | | -Can I use version X `kubectl` with version Y `kubectl-grep`? |
| 44 | +How do I know the version installed is compatible with my cluster version? |
57 | 45 |
|
58 | | -* Sure, no problem |
| 46 | +* Ideally, it should be compatible with [supported Kubernetes versions](https://kubernetes.io/releases/). |
59 | 47 |
|
60 | 48 | What kind of resource(s) `kubectl-grep` support? |
61 | 49 |
|
62 | 50 | * Please refer to [Resource Types](RESOURCE_TYPES.md) |
63 | 51 |
|
64 | | -# Reference |
| 52 | +## 👷 Install |
| 53 | + |
| 54 | +### Recommended way |
| 55 | + |
| 56 | +```bash |
| 57 | +kubectl krew install grep && kubectl krew update && kubectl krew upgrade grep |
| 58 | +``` |
| 59 | + |
| 60 | +### Manually setup (Developer build) |
65 | 61 |
|
66 | | -- [Kubectl Plugins](https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/) |
| 62 | +```bash |
| 63 | +go get -u github.com/guessi/kubectl-grep |
| 64 | +cd ${GOPATH}/src/github.com/guessi/kubectl-grep |
| 65 | +make all |
| 66 | +``` |
67 | 67 |
|
68 | | -# License |
| 68 | +## ⚖️ License |
69 | 69 |
|
70 | 70 | [Apache-2.0](LICENSE) |
0 commit comments