View Source Usage
- Connections (
K8s.Conn
) - Operations (
K8s.Operation
) - Discovery (
K8s.Discovery
) - Middleware (
K8s.Middleware
) - Authentication (
K8s.Conn.Auth
) - Observability
- Testing
- Advanced Topics - CRDs, Multiple Clusters, and Subresource Requests
tl-dr-examples
tl;dr Examples
creating-a-deployment
Creating a deployment
{:ok, conn} = K8s.Conn.from_file("path/to/kubeconfig.yaml")
opts = [namespace: "default", name: "nginx", image: "nginx:nginx:1.7.9"]
{:ok, resource} = K8s.Resource.from_file("priv/deployment.yaml", opts)
operation = K8s.Client.create(resource)
{:ok, deployment} = K8s.Client.run(conn, operation)
listing-deployments
Listing deployments
In a namespace:
{:ok, conn} = K8s.Conn.from_file("path/to/kubeconfig.yaml")
operation = K8s.Client.list("apps/v1", "Deployment", namespace: "prod")
{:ok, deployments} = K8s.Client.run(conn, operation)
Across all namespaces:
{:ok, conn} = K8s.Conn.from_file("path/to/kubeconfig.yaml")
operation = K8s.Client.list("apps/v1", "Deployment", namespace: :all)
{:ok, deployments} = K8s.Client.run(conn, operation)
getting-a-deployment
Getting a deployment
{:ok, conn} = K8s.Conn.from_file("path/to/kubeconfig.yaml")
operation = K8s.Client.get("apps/v1", :deployment, [namespace: "default", name: "nginx-deployment"])
{:ok, deployment} = K8s.Client.run(conn, operation)