NAME
kube_watch - Watch Kubernetes resources for changes
VERSION
version 1.107
SYNOPSIS
# Watch all pods in a namespace
kube_watch Pod -n default
# Watch only deletions
kube_watch Pod -n kube-system -T DELETED
# Watch deployments with a label selector
kube_watch Deployment -n production -l app=web
# Filter by name regex
kube_watch Pod -n default -N 'nginx.*'
# JSON output for piping
kube_watch Pod -o json | jq '.object.metadata.name'
# Watch cluster-scoped resources
kube_watch Node
kube_watch Namespace
DESCRIPTION
kube_watch connects to a Kubernetes cluster and watches for changes to resources of a given type. Events are printed as they arrive in real-time. The watch automatically restarts when the server-side timeout expires, and handles 410 Gone errors by re-listing.
NAME
kube_watch - Watch Kubernetes resources for changes
OPTIONS
- -n, --namespace=NAME
-
Watch resources in this namespace. Omit for cluster-scoped resources.
- -l, --label=SELECTOR
-
Label selector to filter resources (e.g.,
app=web,env=prod). - -f, --field=SELECTOR
-
Field selector to filter resources (e.g.,
status.phase=Running). - -T, --event_type=TYPES
-
Comma-separated list of event types to show. Valid types:
ADDED,MODIFIED,DELETED,BOOKMARK,ERROR. By default all types are shown. - -N, --names=REGEX
-
Perl regex to filter by resource name. Only events for resources whose name matches will be printed.
- -t, --timeout=SECONDS
-
Server-side timeout per watch cycle in seconds. Default: 300. The watch automatically restarts after each cycle.
- -o, --output=FORMAT
-
Output format:
text(default),json, oryaml.textprints a human-readable line per event.jsonprints one JSON object per line (NDJSON), useful for piping tojq. - -F, --timestamp_format=FORMAT
-
Timestamp format for text output. Options:
datetime 2025-02-12 14:23:01 (default) date 2025-02-12 time 14:23:01 epoch 1707745381 iso 2025-02-12T14:23:01+0100 - -c, --context=NAME
-
Kubernetes context to use from the kubeconfig.
- --kubeconfig=PATH
-
Path to kubeconfig file, or a
:-separated list of them. Without it theKUBECONFIGenvironment variable is used, and without that ~/.kube/config.
ENVIRONMENT
KUBECONFIG-
Kubeconfig to use when
--kubeconfigis not given. As withkubectlthis is a:-separated list of files (;-separated on Win32), merged into one configuration: for each named cluster, context and user the first file that defines it wins, andcurrent-contextcomes from the first file that sets one. Entries naming a file that does not exist are skipped, so is an empty entry. See "MERGING" in Kubernetes::REST::Kubeconfig. HOME-
Used to locate the default kubeconfig at ~/.kube/config when neither
--kubeconfignorKUBECONFIGis set. WithHOMEunset as well there is no kubeconfig to read, and the client is built from the pod's service account if there is one, or the error names both variables.
TEXT OUTPUT FORMAT
TIMESTAMP TYPE NAME STATUS
2025-02-12 14:23:01 ADDED default/nginx-abc123 Running
2025-02-12 14:23:01 MODIFIED default/nginx-abc123 Succeeded
2025-02-12 14:23:05 DELETED default/nginx-abc123
SEE ALSO
Kubernetes::REST, "watch" in Kubernetes::REST, Kubernetes::REST::CLI::Watch, kube_client
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/pplu/kubernetes-rest/issues.
IRC
Join #kubernetes on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHORS
Torsten Raudssus <getty@cpan.org>
Jose Luis Martinez Torres <jlmartin@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2019-2026 by Jose Luis Martinez Torres <jlmartin@cpan.org>.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004