NAME

Kubernetes::REST::Kubeconfig - Parse kubeconfig files and create Kubernetes::REST instances

VERSION

version 1.002

SYNOPSIS

use Kubernetes::REST::Kubeconfig;

# Use default kubeconfig and current context
my $kc = Kubernetes::REST::Kubeconfig->new;
my $api = $kc->api;

# Specify kubeconfig and context
my $kc = Kubernetes::REST::Kubeconfig->new(
    kubeconfig_path => '/path/to/kubeconfig',
    context_name => 'my-cluster',
);

# List available contexts
my $contexts = $kc->contexts;

# Get API for specific context
my $api = $kc->api('production');

DESCRIPTION

Parses Kubernetes kubeconfig files (typically ~/.kube/config) and creates configured Kubernetes::REST instances.

Supports:

  • Multiple clusters and contexts

  • Token authentication

  • Client certificate authentication

  • Inline certificate data (base64 encoded)

  • External certificate files

  • Exec-based credential plugins

kubeconfig_path

Path to the kubeconfig file. Defaults to ~/.kube/config.

context_name

Optional. The context name to use. If not specified, uses the current-context from the kubeconfig.

current_context_name

my $name = $kc->current_context_name;

Returns the current context name (either from context_name attribute or from the kubeconfig's current-context).

contexts

my $contexts = $kc->contexts;

Returns an arrayref of all available context names from the kubeconfig.

api

my $api = $kc->api;
my $api = $kc->api('production');

Create a Kubernetes::REST instance configured from the kubeconfig. If $context_name is provided, uses that context; otherwise uses the current context.

Automatically resolves:

  • Server endpoint and SSL settings

  • Authentication credentials (token or exec plugin)

  • Client certificates (from files or inline base64 data)

  • CA certificate for server verification

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 <torsten@raudssus.de>

  • Jose Luis Martinez Torres <jlmartin@cpan.org> (JLMARTIN, original author, inactive)

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by Jose Luis Martinez.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004