class Kube::Config
- Kube::Config
- Reference
- Object
Included Modules
- JSON::Serializable
- Kube::Config::Var
- YAML::Serializable
Defined in:
kube/config.crkube/config/cluster.cr
kube/config/context.cr
kube/config/user.cr
kube/config/var.cr
Constructors
- .new(clusters : Array(Kube::Config::Cluster), contexts : Array(Kube::Config::Context), current_context : Nil | String, preferences : Hash(String, String) = Hash(String, String).new, users : Array(Kube::Config::User) = Array(User).new, api_version : String = "v1", kind : String = "Config")
- .new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
- .new(pull : JSON::PullParser)
- .new
Class Method Summary
-
.autoconfig
Attempts to create a
Kube::Config
automatically using environment variables, or existing configuration files. -
.build(server : String, ca : String, auth_token : String, cluster_name : String = "kubernetes", user : String = "k8s-client", context : String = "k8s-client", **options)
Build a minimal configuration from at least a server address, server certificate authority data and an access token.
- .defaults
- .from_hash(data)
-
.from_kubeconfig_env(kubeconfig = nil) : Kube::Config
Loads configuration files listed in KUBE_CONFIG environment variable and merge using the configuration merge rules, @see K8s::Config.merge
-
.load_file(path : String) : Kube::Config
Loads a configuration from a YAML file
Instance Method Summary
- #api_version : String
- #api_version=(api_version : String)
-
#cluster(name : String | Nil = nil) : Cluster
Returns the cluster with the given
name
or the cluster of the current context - #clusters : Array(Cluster)
- #clusters=(clusters : Array(Cluster))
-
#context(name : String | Nil = nil) : Context
Returns the context with the given
name
or the current context - #contexts : Array(Context)
- #contexts=(contexts : Array(Context))
- #current_context : String | Nil
- #current_context=(current_context : String | Nil)
- #kind : String
- #kind=(kind : String)
-
#merge(other : Kube::Config) : Kube::Config
Merges configuration according to the rules specified in https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files
- #merge!(other : Kube::Config) : Kube::Config
- #preferences : Hash(String, String)
- #preferences=(preferences : Hash(String, String))
-
#user(name : String | Nil = nil) : User
Returns the user with the given
name
or the user of the current context - #users : Array(User)
- #users=(users : Array(User))
Instance methods inherited from module Kube::Config::Var
to_h
to_h
Constructor Detail
Class Method Detail
Attempts to create a Kube::Config
automatically using environment variables, or
existing configuration files.
Look-up order:
- KUBE_TOKEN, KUBE_CA, KUBE_SERVER environment variables
- KUBECONFIG environment variable
- $HOME/.kube/config file
Will raise when no means of configuration is available
Build a minimal configuration from at least a server address, server certificate authority data and an access token.
Loads configuration files listed in KUBE_CONFIG environment variable and merge using the configuration merge rules, @see K8s::Config.merge
Instance Method Detail
Returns the cluster with the given name
or the cluster of the current context
Returns the context with the given name
or the current context
Merges configuration according to the rules specified in https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files
Returns the user with the given name
or the user of the current context