k8s v0.5.0 K8s.Conn
Handles authentication and connection configuration details for a Kubernetes cluster.
Connections can be registered via Mix.Config or environment variables.
Connections can also be dynamically built during application runtime.
Link to this section Summary
Functions
Reads configuration details from a kubernetes config file.
Generates configuration from kubernetes service account.
List of all registered connections. Connections are registered via Mix.Config or env variables.
Lookup a registered connection by name. See K8s.Conn.Config
.
Link to this section Types
Link to this section Functions
from_file(config_file, opts \\ [])
from_file(binary(), keyword()) :: K8s.Conn.t()
Reads configuration details from a kubernetes config file.
Defaults to current-context
.
Options
context
sets an alternate contextcluster
set or override the cluster read from the contextuser
set or override the user read from the contextdiscovery_driver
module name to use for discoverydiscovery_opts
options for discovery module
Generates configuration from kubernetes service account.
Links
from_service_account(cluster_name)
from_service_account(atom()) :: K8s.Conn.t()
from_service_account(cluster_name, root_sa_path)
from_service_account(atom(), String.t()) :: K8s.Conn.t()
List of all registered connections. Connections are registered via Mix.Config or env variables.
Examples
K8s.Conn.list()
[%K8s.Conn{ca_cert: nil, auth: %K8s.Conn.Auth{}, cluster_name: :"docker-for-desktop-cluster", discovery_driver: K8s.Discovery.Driver.File, discovery_opts: [config: "test/support/discovery/example.json"], insecure_skip_tls_verify: true, url: "https://localhost:6443", user_name: "docker-for-desktop"}]
lookup(cluster_name)
lookup(atom()) :: {:ok, K8s.Conn.t()} | {:error, :connection_not_registered}
Lookup a registered connection by name. See K8s.Conn.Config
.
Examples
K8s.Conn.lookup(:test)
{:ok, %K8s.Conn{ca_cert: nil, auth: %K8s.Conn.Auth{}, cluster_name: :"docker-for-desktop-cluster", discovery_driver: K8s.Discovery.Driver.File, discovery_opts: [config: "test/support/discovery/example.json"], insecure_skip_tls_verify: true, url: "https://localhost:6443", user_name: "docker-for-desktop"}}