NAME Net::Kubernetes VERSION version 0.03 SYNOPSIS my $kube = Net::Kubernets->new(url=>'http://127.0.0.1:8080', username=>'dave', password=>'davespassword'); my $pod_list = $kube->list_pods(); my $nginx_pod = $kube->create_from_file('kubernetes/examples/pod.yaml'); my $ns = $kube->get_namespace('default'); my $services = $ns->list_services; my $pod = $ns->get_pod('my-pod'); $pod->delete; my $other_pod = $ns->create_from_file('./my-pod.yaml'); Description This package allows programatic access to the Kubernetes rest api. Please note this package is still a BETA release (as is kubernetes itself), and the methods and API are still subject to change. Use at your own risk. Methods By convention, methods will throw exceptions if kubernetes api server returns a non-successful status code. Unless otherwise noted, assume this behavoir through out. new - Create a new $kube object All parameters are optional and have some basic default values (where appropriate). url ['http://localhost:8080'] The base url for the kubernetes. This should include the protocal (http or https) but not "/api/v1beta3" (see base_path). base_path ['/api/v1beta3'] The entry point for api calls, this may be used to set the api version with which to interact. username Username to use with basic authentication. If either username or password are not provided, basic authentication will not be used. password Password to use with basic authentication. If either username or password are not provided, basic authentication will not be used. token An authentication token to be used to access the apiserver. This may be provided as a plain string, a path to a file from which to read the token (like /var/run/secrets/kubernetes.io/serviceaccount/token from within a pod), or a reference to a file handle (from which to read the token). List resources These methods retrieve lists (optionally limited by field or label selector) of the various resources types kubernetes makes available via the API servers rest interface. These methods may also be called on a "Namespace" object, which will implicitly limit the result set by namespace. All of these methods will return an array (or and array ref denpending on context) of the approriate resource type (Net::Kubernetes::Resource::Pod for example). $kube->list_pods([label=>{label=>value}], [fields=>{field=>value}]) $kube->list_rc([label=>{label=>value}], [fields=>{field=>value}]) $kube->list_replication_controllers([label=>{label=>value}], [fields=>{field=>value}]) (alias to list_rc) $kube->list_secrets([label=>{label=>value}], [fields=>{field=>value}]) $kube->list_services([label=>{label=>value}], [fields=>{field=>value}]) Create Methods These methods may be called either globally or on a namespace object. The return value is is an object of the approriate type (determined by the "Kind" field) my $resource = $kube->create({OBJECT}) my $resource = $kube->create_from_file(PATH_TO_FILE) (accepts either JSON or YAML files) Create from file is really just a short cut around something like: my $object = YAML::LoadFile(PATH_TO_FILE); $kube->create($object); Global scoped methods These methods are only available at the top level (i.e. not available via a namespace object) $kube->get_namespace("myNamespace"); This method returns a "Namespace" object on which many methods can be called implicitly limited to the specified namespace. Namespace methods These methods are accessible only from a name-space object. $ns->get_pod('my-pod-name') $ns->get_repllcation_controller('my-rc-name') (aliased as $ns->get_rc('my-rc-name')) $ns->get_service('my-servce-name') $ns->get_secret('my-secret-name') Resource Methods These methods can be called directly on a resource object. $resource->delete $resource->refresh (update object from api server) $resource->update (send local changes to api server) This method is only available for resources which have a status (currently everything other than secretes). AUTHOR Dave Mueller COPYRIGHT AND LICENSE This software is copyright (c) 2015 by Dave Mueller. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.