NAME
Kubernetes::REST::CLI::Watch - CLI for watching Kubernetes resources
VERSION
version 1.107
SYNOPSIS
use Kubernetes::REST::CLI::Watch;
my $watcher = Kubernetes::REST::CLI::Watch->new_with_options;
$watcher->run($ARGV[0]);
DESCRIPTION
MooX::Options-based class that powers the kube_watch CLI tool. Uses Kubernetes::REST::CLI::Role::Connection for shared kubeconfig/auth handling.
namespace
Namespace to watch. Omit for cluster-scoped resources or to watch all namespaces.
Short option: -n
output
Output format: text (default), json, or yaml.
Short option: -o
timeout
Server-side timeout per watch cycle in seconds. Default: 300.
Short option: -t
event_type
Comma-separated list of watch event types to show, e.g. ADDED,DELETED. Matched case-insensitively (values are uppercased before comparing) against ADDED, MODIFIED, DELETED, ERROR, and BOOKMARK. Omit to show all event types.
Short option: -T
label
Kubernetes label selector passed through as labelSelector, e.g. app=web,env=prod.
Short option: -l
field
Kubernetes field selector passed through as fieldSelector, e.g. status.phase=Running.
Short option: -f
names
Perl regular expression. Only events for resources whose metadata.name matches are printed; all others are silently skipped. Applied client-side, after the event has already been received from the server.
Short option: -N
timestamp_format
Timestamp format used in text output. One of datetime (%Y-%m-%d %H:%M:%S, the default), date, time, epoch (seconds since the Unix epoch), or iso. Ignored for json/yaml output.
Short option: -F
run
$watcher->run($kind);
Watches resources of $kind, printing each event as it arrives (formatted per --output). Calls "watch" in Kubernetes::REST in an infinite loop: a normal server-side timeout restarts the watch from the last seen resourceVersion, and a 410 Gone (the resourceVersion has expired) warns and restarts a fresh watch from scratch. Any other error is rethrown. Dies with a usage message if $kind is missing. This method never returns under normal operation - it is the entry point called by bin/kube_watch.
SEE ALSO
"watch" in Kubernetes::REST - Watch API documentation
Kubernetes::REST::CLI::Role::Connection - Shared CLI options
Kubernetes::REST::WatchEvent - Watch event object
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