https://github.com/leopoldxx/kube-watch-diff
A kubectl plugin for watching resources and generating diffs.
https://github.com/leopoldxx/kube-watch-diff
diff kubectl-plugin watch
Last synced: 5 months ago
JSON representation
A kubectl plugin for watching resources and generating diffs.
- Host: GitHub
- URL: https://github.com/leopoldxx/kube-watch-diff
- Owner: leopoldxx
- License: apache-2.0
- Created: 2020-12-26T15:42:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-16T10:44:43.000Z (over 5 years ago)
- Last Synced: 2024-06-20T16:34:16.907Z (about 2 years ago)
- Topics: diff, kubectl-plugin, watch
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 26
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
```txt
____ __ ____ ___ .___________. ______ __ __ _______ __ _______ _______
\ \ / \ / / / \ | | / || | | | ___ | \ | | | ____|| ____|
\ \/ \/ / / ^ \ |---| |----|| |---/ | |__| | ( _ ) | .--. || | | |__ | |__
\ / / /_\ \ | | | | | __ | / _ \/\ | | | || | | __| | __|
\ /\ / / _____ \ | | | \----.| | | | | (_> < | '--' || | | | | |
\__/ \__/ /__/ \__\ |__| \______||__| |__| \___/\/ |_______/ |__| |__| |__|
```
# Notes
A kubectl plugin for watching resources and generating diffs.
If you want to watch multiple objects, and some of them are namespace-scoped, then they must be in the same namespace.
# Prerequisite
This tool need `diff` utility for files comparison, so make sure `diffutils` has already been installed.
> GNU Diffutils: https://www.gnu.org/software/diffutils/
If you want a colorful output, you can install `colordiff` wrapper for `diff` tool.
> Colordiff: https://www.colordiff.org/
# Install
1. You can download the release package manually:
> https://github.com/leopoldxx/kube-watch-diff/releases
2. Or, install using the installation script:
> curl -sfL https://raw.githubusercontent.com/leopoldxx/kube-watch-diff/master/install.sh | sh -s -- -b /usr/bin
# Usage
You could use it like the examples below(install as kubectl plugin):
```shell
# watch a namespace scoped resource(use without kubectl)
kubectl-watch pod pod1
```
```shell
# watch a clusters scoped resource
kubectl watch node node1
```
```shell
# watch multiple resources in a same namespace
kubectl watch nodes/node1 pods/pod1 pods/pod2
```
```shell
# watch multiple resources using a label selector
kubectl watch pods -l far=bar
kubectl watch deployment,rs -l far=bar
```
```shell
# watch all pods on the same node
kubectl watch pods --field-selector spec.nodeName=192.168.1.1
```
```shell
# watch 'all' category resource using label selector
kubectl watch all -l far=bar -n test-ns
```
```shell
# watch all masters
kubectl watch node -l node-role.kubernetes.io/master=""
```
```shell
# watch all nodes, and record the diffs into a file
kubectl-watch nodes --all 2>/dev/null | tee nodes.diff
```