https://github.com/ahmetb/kubectl-pods_on
kubectl plugin to query Pods by Node names or selectors
https://github.com/ahmetb/kubectl-pods_on
kubectl kubectl-plugin kubectl-plugins
Last synced: about 1 year ago
JSON representation
kubectl plugin to query Pods by Node names or selectors
- Host: GitHub
- URL: https://github.com/ahmetb/kubectl-pods_on
- Owner: ahmetb
- License: apache-2.0
- Created: 2024-02-04T00:01:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-10T19:22:04.000Z (over 1 year ago)
- Last Synced: 2025-03-30T05:06:25.302Z (over 1 year ago)
- Topics: kubectl, kubectl-plugin, kubectl-plugins
- Language: Go
- Homepage:
- Size: 44.9 KB
- Stars: 123
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `kubectl pods-on`
A kubectl plugin to query list of pods running on a Node (by name or Node label
selector).
If you ever found yourself finding a list of Pods on a particular Node or a
set of Nodes, you'll find this plugin useful.
### Features
- Query multiple Node names at the same time.
- Specify Node selectors (instead of Node names) to query
- Supports `-o/--output=json|yaml|wide|jsonpath|go-template|...` formats (just
like `kubectl`)
- Performance optimizations like parallel queries.
- Runs fast on large clusters, as it employs different query strategies based on
the cluster size.
### Examples
- List all pods running on a node (or more nodes):
```sh
kubectl pods-on [...]
```
- List all pods running on nodes with a specific label:
```sh
kubectl pods-on pool=general
```
- List all pods running on nodes that match a particular selector:
```sh
kubectl pods-on "topology.kubernetes.io/zone in (us-west-1a, us-west-1b)"
```
- A combination of both syntaxes (the results of each selector will be OR'ed):
```sh
kubectl pods-on \
"tier in (db, cache)" \
"foo=bar"\
node1.example.com
```
### Installation
#### Install using Krew
1. Install [Krew](https://krew.sigs.k8s.io) using [its installation
guide](https://krew.sigs.k8s.io/docs/user-guide/setup/install/).
1. Run `kubectl krew install pods-on`.
1. `kubectl pods-on` is ready to use!
#### Install using `go` (not recommended)
In this method, you will not receive any updates to the plugin unless you
manually run `go install` again.
1. ```sh
go install github.com/ahmetb/kubectl-pods_on@latest
```
2. Add `$HOME/go/bin` to your `PATH`.
3. Run `kubectl pods-on`!
### License
Distributed as-is under Apache 2.0. See [LICENSE](./LICENSE).