class Kube::Client
- Kube::Client
- Reference
- Object
Overview
Top-level client wrapper.
Uses a Transport
instance to talk to the kube API.
Offers access to Kube::ApiClient
and ResourceClient
instances.
Defined in:
kube-client/version.crkube/client.cr
Constant Summary
-
VERSION =
"0.4.2"
Constructors
Class Method Summary
-
.autoconfig(namespace : String | Nil = nil, **options) : Kube::Client
Attempts to create a K8s::Client instance automatically using environment variables, existing configuration files or in cluster configuration.
- .config(config : Kube::Config, namespace : String | Nil = nil, **options) : Kube::Client
-
.in_cluster_config(namespace : String | Nil = nil, **options) : Kube::Client
An
Kube::Client
instance from in-cluster config within a kube pod, using the kubernetes service envs and serviceaccount secrets - .logger
Instance Method Summary
-
#api(api_version : String = "v1") : Kube::ApiClient
api_version [String] "group/version" or "version" (core)
-
#api_groups : Array(String)
Cached /apis preferred group apiVersions
-
#api_groups! : Array(String)
Force-update /apis cache.
-
#apis(api_versions = nil, prefetch_resources = false, skip_missing = false)
api_versions [Array(String)] defaults to all APIs prefetch_resources [Bool] prefetch any missing api_resources for each api_version skip_missing [Bool] return Kube::ApiClient without api_resources? if 404
- #client_for_resource(resource : T, namespace : String | Nil = nil) forall T
- #create_resource(resource : T) forall T
- #delete_resource(resource : T, **options) forall T
- #get_resource(resource : T) forall T
- #get_resources(resources : Enumerable(T)) forall T
-
#list_resources(resources : Array(Kube::ResourceClient) | Nil = nil, **options)
Pipeline list requests for multiple resource types.
- #logger
- #patch_resource(resource, attrs)
-
#resources(namespace : String | Nil = nil)
namespace [String, nil]
- #update_resource(resource : T) forall T
- #version : K8S::Apimachinery::Version::Info
Constructor Detail
Class Method Detail
Attempts to create a K8s::Client instance automatically using environment variables, existing configuration files or in cluster configuration.
Look-up order:
- KUBE_TOKEN, KUBE_CA, KUBE_SERVER environment variables
- KUBECONFIG environment variable
- $HOME/.kube/config file
- In cluster configuration
Will raise when no means of configuration is available
An Kube::Client
instance from in-cluster config within a kube pod, using the kubernetes service envs and serviceaccount secrets
Instance Method Detail
api_version [String] "group/version" or "version" (core)
Force-update /apis cache. Required if creating new CRDs/apiservices.
api_versions [Array(String)] defaults to all APIs prefetch_resources [Bool] prefetch any missing api_resources for each api_version skip_missing [Bool] return Kube::ApiClient without api_resources? if 404
Pipeline list requests for multiple resource types.
Returns flattened array with mixed resource kinds.