#!/usr/bin/env perl
# PODNAME: kube_client
# ABSTRACT: Kubernetes CLI client using Kubernetes::REST

use strict;
use warnings;

use Kubernetes::REST::CLI;

our $VERSION = '1.107';

Kubernetes::REST::CLI->new_with_cmd;

__END__

=pod

=encoding UTF-8

=head1 NAME

kube_client - Kubernetes CLI client using Kubernetes::REST

=head1 VERSION

version 1.107

=head1 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

=head1 DESCRIPTION

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

=head1 NAME

kube_client - Kubernetes CLI client using Kubernetes::REST

=head1 OPTIONS

=over 4

=item B<--kubeconfig>=PATH

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

=item B<-c>, B<--context>=NAME

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

=item B<-n>, B<--namespace>=NAME

Namespace for namespaced resources. Defaults to C<default>.

=item B<-o>, B<--output>=FORMAT

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

=back

=head1 COMMANDS

=head2 get

    kube_client get <Kind> [name]

Get one or more resources. If C<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

=head2 create

    kube_client create -f <file>

Create resources from a YAML or JSON manifest. Use C<-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 C<--->-separated document is created in
the order it appears, and each created object is printed in the C<--output>
format.

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

=head2 delete

    kube_client delete <Kind> <name>

Delete a resource by kind and name.

    kube_client delete Pod nginx
    kube_client delete Namespace test

=head2 raw

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

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

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

=head1 ENVIRONMENT

=over 4

=item C<KUBECONFIG>

Kubeconfig to use when C<--kubeconfig> is not given. As with C<kubectl> this is
a C<:>-separated list of files (C<;>-separated on Win32), merged into one
configuration: for each named cluster, context and user the first file that
defines it wins, and C<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 L<Kubernetes::REST::Kubeconfig/MERGING>.

=item C<HOME>

Used to locate the default kubeconfig at F<~/.kube/config> when neither
C<--kubeconfig> nor C<KUBECONFIG> is set. With C<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.

=item C<HIDE_KUBERNETES_REST_V0_API_WARNING>

Silences the deprecation warning C<raw> prints on every call.

=back

=head1 SEE ALSO

L<Kubernetes::REST>, L<Kubernetes::REST::CLI>, L<IO::K8s>

=head1 SUPPORT

=head2 Issues

Please report bugs and feature requests on GitHub at
L<https://github.com/pplu/kubernetes-rest/issues>.

=head2 IRC

Join C<#kubernetes> on C<irc.perl.org> or message Getty directly.

=head1 CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

=head1 AUTHORS

=over 4

=item *

Torsten Raudssus <getty@cpan.org>

=item *

Jose Luis Martinez Torres <jlmartin@cpan.org>

=back

=head1 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

=cut
