builtin:kubernetes#

Runs a local Kubernetes cluster. The driver field names the tool that creates it. See Kubernetes clusters.

cluster: {
    uses: "builtin:kubernetes"
    with: {
        driver: "kind"
        workers: worker_a: {}
        egress: ["docker.io", "*.docker.io", "*.docker.com"]
    }
}
FieldTypeDefaultDescription
driver"kind" | "k3d" | "minikube"-Required. The tool that creates the cluster: "kind", "k3d", or "minikube".
namestring-The cluster name. Defaults to "<project>-<step>".
workers[string]: #NodeConfig-Creates one worker node for each key, in addition to the control-plane node. The key names the node: kevin sets it as the "kevin.node" node label, and builtin:fault accepts it in containers. Each value takes the node settings described for "#NodeConfig".
waitstring"5m"How long to wait for the control plane to become ready, such as "5m".
retainbool-Keeps the nodes when the cluster fails to start, so you can inspect them.
proxybooltrueSets the kevin proxy environment variables in every node.
egress[...string]-Lists external hosts that the nodes can reach when proxy.egress.deny is true.
corednsbooltrueConfigures the cluster DNS so that pods can resolve names on the environment domain, such as "web.kevin.home".
trust_cabooltrueInstalls the kevin root certificate in every node, so that image pulls through the kevin proxy succeed.
expose[string]: #Expose-Makes an address inside the cluster, such as a Service DNS name and port, reachable from the host through a relay pod. The key names the entry in the console. The step does not wait for the address to accept connections: use a builtin:wait step with the "expose_<name>" system value.
relaybool-Deploys the relay pod even when expose is empty, and sets the relay_addr output. Use it with builtin:route to give a Service in the cluster a name on the environment domain.
mounts[...#Mount]-Makes host paths visible in every node of the cluster.
kind#Kind-Holds the settings that only the "kind" driver has.
k3d#K3d-Holds the settings that only the "k3d" driver has.
minikube#Minikube-Holds the settings that only the "minikube" driver has.

Drivers#

DriverCommand on the host
kindkind
k3dk3d
minikubeminikube

#Kind#

FieldTypeDefaultDescription
imagestring-The node image, such as "kindest/node:v1.34.0". Unset uses the default of the installed kind version.
control_plane#NodeConfig-Adds kind node settings to the control-plane node, with kind’s field names, such as extraMounts or kubeadmConfigPatches (see https://kind.sigs.k8s.io/docs/user/configuration/#per-node-options). labels and extraMounts add to the values kevin sets. The "kevin.node" label and role cannot be set.
configstring-A complete kind cluster configuration in YAML. It replaces the configuration kevin generates: control_plane and workers have no effect.

#K3d#

FieldTypeDefaultDescription
imagestring-The k3s image, such as "rancher/k3s:v1.34.1-k3s1". Unset uses the default of the installed k3d version.
disable[...#K3sComponent]-Turns off bundled k3s components.
env[string]: string-Sets environment variables in every node. kevin sets the proxy variables itself, so they are an error here.
memory#MemoryLimit-Limits the memory of each node, such as "2g".
labels[string]: string-Adds labels to every node. The "kevin.node" label cannot be set.

#K3sComponent is one of "traefik", "servicelb", "metrics-server", or "local-storage". #MemoryLimit is a number with an optional unit of b, k, m, or g, in either case, such as "512m" or "2g".

#Minikube#

FieldTypeDefaultDescription
kubernetes_versionstring-The Kubernetes version of the cluster, such as "v1.33.1". When unset, kevin uses the default of the installed minikube version.
base_imagestring-The node image. When unset, kevin uses the default of the installed minikube version.
memory#MemoryLimit-Limits the memory of each node, such as "2g".
cpusint & >0-Limits the CPUs of each node.

#Mount#

FieldTypeDefaultDescription
hoststring-Required. The path on your machine. A relative path is relative to the project directory.
containerstring-Required. The path inside each node.
readonlybool-Mounts the path read-only.

#NodeConfig#

kind.control_plane and each workers value take node settings. The kind driver accepts kind’s per-node options, with kind’s field names. The k3d and minikube drivers accept none, so write each workers value as {}. For example, with kind:

cluster: {
    uses: "builtin:kubernetes"
    with: {
        driver: "kind"
        kind: control_plane: extraMounts: [{hostPath: "./src", containerPath: "/workspace"}]
        workers: worker_a: image: "kindest/node:v1.34.0"
    }
}

kevin merges these with its own node settings:

  • labels adds to the kevin.node label. You cannot set kevin.node.
  • extraMounts adds to the entries from mounts.
  • You cannot set role.

The control-plane node has the label kevin.node: control-plane.

#Expose#

FieldTypeDefaultDescription
addressstring-Required. The in-cluster host:port to reach, such as "postgres.default.svc.cluster.local:5432".
protocol"tcp" | "udp""tcp"The transport protocol of the address.
host_portint-Sets the port of the "forward_<name>" address on the host. Unset, the OS picks a free port.

Outputs#

KeyValue
nameCluster name.
kubeconfigAbsolute path of the kubeconfig file.
contextkubeconfig context. kind-<name> for the kind driver, k3d-<name> for the k3d driver, <name> for the minikube driver.
nodesComma-separated node names.
relay_addrHost address of the relay pod, when relay is true or expose has entries. Use it with a builtin:route step.

System values#

For each expose entry:

KeyValue
expose_<name>Relay address, as socks5://<relay>/<address>. A builtin:wait tcp check accepts it.
forward_<name>A 127.0.0.1:<port> address that forwards to address through the relay.

Behavior#

  • If a cluster with the same name exists, and neither its settings nor the proxy address changed, the step uses it. Otherwise the step deletes it and creates a new one.
  • The step deletes the cluster on teardown.
  • The step supports export: a setup.<step> need or a command can read name, kubeconfig, context, and relay_addr.
  • Each node is a container that builtin:fault can target by its workers key, or by control-plane for the control-plane node.
  • The k3d driver runs on the docker and podman engines.
  • The k3d driver publishes the API server on 127.0.0.1 only.
  • The k3d nodes pull the k3s system images, such as rancher/mirrored-pause, while the cluster starts. This step’s egress applies later, so proxy.egress.allow must cover those registries when proxy.egress.deny is true.
  • The minikube driver runs on the docker and podman engines. Under podman, minikube needs a rootful Podman.
  • The minikube driver publishes the API server on 127.0.0.1 only.
  • mounts applies to every node. With the kind driver, kind.config replaces the generated configuration, so mounts has no effect. The minikube driver accepts at most one mounts entry.
  • With the k3d driver, trust_ca mounts the kevin root certificate into each node at cluster creation. With the minikube driver, it installs the certificate in each node at cluster creation. The step replaces a cluster whose certificate no longer matches.
  • Each node also joins the project network. See The project network.