Kubernetes API event watcher.
go get -u github.com/softonic/kubewatch
eval "$(kubewatch --completion-script-${0#-})"
kubewatch --help
usage: kubewatch [<flags>] <resources>...
Watches Kubernetes resources via its API.
Flags:
-h, --help Show context-sensitive help (also try --help-long and --help-man).
--kubeconfig Absolute path to the kubeconfig file.
--namespace Set the namespace to be watched.
--flatten Whether to produce flatten JSON output or not.
--version Show application version.
Args:
<resources> Space delimited list of resources to be watched.
Watch for pods and events in all namespaces:
kubewatch pods events | jq '.'
Same thing with docker:
docker run -it --rm \
-v ~/.kube/config:/root/.kube/config \
softonic/kubewatch pods events | jq '.'
Watch for services events in namespace foo:
kubewatch --namespace foo services | jq '.'
Same thing with docker:
docker run -it --rm \
-v ~/.kube/config:/root/.kube/config \
softonic/kubewatch --namespace foo services | jq '.'
Run kubewatch in the monitoring namespace and watch for pods in all namespaces:
kubectl --namespace monitoring run kubewatch --image softonic/kubewatch -- pods
Run kubewatch in the monitoring namespace and watch for pods, deployments and events objects in all namespaces. Also flatten the json output:
kubectl --namespace monitoring \
run kubewatch --image softonic/kubewatch \
-- --flatten pods deployments events