NAME

kube_client - Kubernetes CLI client using Kubernetes::REST

VERSION

version 1.107

SYNOPSIS

# List all pods in default namespace
kube_client get Pod

# Get specific pod
kube_client get Pod nginx

# List pods in specific namespace
kube_client get Pod -n kube-system

# Output as YAML
kube_client get Pod -o yaml

# Output only names
kube_client get Pod -o name

# Create resources from a YAML or JSON manifest
kube_client create -f pod.yaml

# Multi-document YAML creates every document in order
kube_client create -f manifests/all.yaml

# Create resource from stdin
cat pod.json | kube_client create

# Delete resource
kube_client delete Pod nginx -n default

# Use different context
kube_client -c production get Pod

# Use different kubeconfig
kube_client --kubeconfig /path/to/config get Pod

# Raw API call
kube_client raw Core ListNamespace
kube_client raw Core ReadNamespacedPod namespace=default name=nginx

DESCRIPTION

kube_client is a command-line tool for interacting with Kubernetes clusters using the Kubernetes::REST Perl library. It reads cluster configuration from your kubeconfig file (typically ~/.kube/config).

NAME

kube_client - Kubernetes CLI client using Kubernetes::REST

OPTIONS

--kubeconfig=PATH

Path to kubeconfig file, or a :-separated list of them. Without it the KUBECONFIG environment variable is used, and without that ~/.kube/config.

-c, --context=NAME

Kubernetes context to use. Defaults to current-context from kubeconfig.

-n, --namespace=NAME

Namespace for namespaced resources. Defaults to default.

-o, --output=FORMAT

Output format: json (default), yaml, or name.

COMMANDS

get

kube_client get <Kind> [name]

Get one or more resources. If name is provided, fetches that specific resource. Otherwise lists all resources of that kind.

kube_client get Pod
kube_client get Pod nginx
kube_client get Deployment -n production
kube_client get Node -o yaml

create

kube_client create -f <file>

Create resources from a YAML or JSON manifest. Use -f - to read from stdin, which is also the default. The format is detected from the content, so stdin works exactly like a named file.

Multi-document YAML is supported: every ----separated document is created in the order it appears, and each created object is printed in the --output format.

kube_client create -f deployment.yaml
kube_client create -f manifests/all.yaml
cat pod.json | kube_client create

delete

kube_client delete <Kind> <name>

Delete a resource by kind and name.

kube_client delete Pod nginx
kube_client delete Namespace test

raw

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

Make a raw API call through the deprecated v0 API groups. Group is a Kubernetes::REST::V0Group subclass name without a version suffix - Core, Apps, Batch and so on, not CoreV1 or AppsV1.

kube_client raw Core ListNamespace
kube_client raw Core ReadNamespacedPod namespace=default name=nginx
kube_client raw Apps ListNamespacedDeployment namespace=default

ENVIRONMENT

KUBECONFIG

Kubeconfig to use when --kubeconfig is not given. As with kubectl this 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, and current-context comes 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 --kubeconfig nor KUBECONFIG is set. With HOME unset 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.

HIDE_KUBERNETES_REST_V0_API_WARNING

Silences the deprecation warning raw prints on every call.

SEE ALSO

Kubernetes::REST, Kubernetes::REST::CLI, IO::K8s

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