NAME

Kubernetes::REST::CLI - CLI base class for Kubernetes::REST command-line tools

VERSION

version 1.107

SYNOPSIS

kube_client <command> [options]

# Get resources
kube_client get Pod my-pod -n default
kube_client get Deployment --output yaml

# Create from file
kube_client create -f deployment.yaml

# Delete resources
kube_client delete Pod my-pod -n default

DESCRIPTION

Base class for the kube_client command-line tool. Provides common functionality for managing Kubernetes resources from the command line.

This tool uses Kubernetes::REST::Kubeconfig to connect to the cluster: --kubeconfig if given, otherwise the KUBECONFIG environment variable, otherwise ~/.kube/config. A :-separated list of kubeconfig files is merged the way kubectl merges it, see "MERGING" in Kubernetes::REST::Kubeconfig.

COMMANDS

get

kube_client get <Kind> [name] [options]

Get a resource or list resources.

get Pod - List all pods in the namespace
get Pod my-pod - Get a specific pod
--output json (default) - JSON output
--output yaml - YAML output
--output name - Names only

create

kube_client create -f <file>

Create resources from a YAML or JSON manifest. Use -f - to read from stdin. The format is detected from the content, and multi-document YAML creates every ----separated document in order.

delete

kube_client delete <Kind> <name> [options]

Delete a resource by name.

raw

kube_client raw <Group> <Method> [key=value ...]

Make a raw call through the deprecated v0 API.

GLOBAL OPTIONS

namespace

Namespace for namespaced resources. Defaults to default.

Short form: -n

output

Output format. One of: json, yaml, name.

Defaults to json.

Short form: -o

ATTRIBUTES

json

JSON::MaybeXS encoder instance used for --output json. Configured pretty, canonical (stable key ordering) and utf8 - the utf8 flag is what makes format_output print UTF-8 bytes instead of characters, so non-ASCII values survive the way to the terminal instead of triggering "Wide character in print".

METHODS

format_output

$cli->format_output($result);

Format and print the result according to the --output option (json, yaml, or name). Any other value falls back to a raw dump via Data::Dumper, mainly useful for debugging.

execute

Default execute method, invoked by MooX::Cmd when kube_client is run without a recognized subcommand. Prints usage information to STDOUT.

SEE ALSO

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