K0s Cluster
01README
Install and operate a SHA-pinned k0s Kubernetes cluster on a Linux host over SSH, with a rendered k0s.yaml, readiness waits, kubeconfig capture, manifest stacks and Helm reconciliation. One model type serves any host: the SSH target and cluster inputs arrive per call, and state is keyed by the target host.
02Behaviors
@randybias/k0s-clusterv2026.10.17.3k0s_cluster.ts
fn render_config()
READ-ONLY. Render the deterministic k0s.yaml for the given cluster inputs and store it as a file. Manifest stacks are not part of k0s.yaml (k0s reads them from its manifest directory), so their planned layout is returned separately.
fn install()
DESTRUCTIVE. Fetch the pinned k0s binary, verify its SHA-256, upload it with k0s.yaml and install the role, then start the service. Idempotent: a re-run adopts the running service and never installs a second node. Refuses to change an installed role unless confirm_role_change names the host; the replacement is downloaded and verified before the old role is torn down.
fn upgrade()
DESTRUCTIVE. Upgrade the installed k0s binary to the pinned version, verifying the new binary before anything is stopped; a lower version and a Kubernetes minor skip are refused, and the same version is a no-op. On any failure after the stop the previous binary is restored and the unit restarted.
fn wait_ready()
READ-ONLY. Poll until a node reports Ready and the kube-system pods are running, up to ready_timeout_s. Returns ready false after the timeout; a connection, authentication or host-key failure is raised, never reported as not-ready. Stores readiness evidence.
fn kubeconfig()
READ-ONLY. Fetch the admin kubeconfig and keep it as a sensitive value, or write it to a vault key named by store_in_vault. The kubeconfig text never appears in the return value, logs or --json output; only its SHA-256, server URL and the vault key are returned.
fn apply_manifests()
DESTRUCTIVE. Place a named manifest stack under the k0s manifest directory, uploading only changed files and removing files no longer declared. Idempotent: re-applying identical files changes nothing. Returns the stack, its files and whether anything changed.
fn apply_helm()
DESTRUCTIVE. Reconcile the declared Helm extensions in k0s.yaml, restarting the controller only when the file changes, then wait until each release is present. Idempotent on an unchanged file. Fails if the controller does not restart healthy or a chart does not reconcile in time.
fn get()
READ-ONLY. Read the k0s version, node status, config digest, manifest stacks and Helm releases from the host and store them. Reports whether a kubeconfig has been recorded.
fn sync()
READ-ONLY. Compare the recorded install with the live host and report drift, refreshing the stored status. Returns whether the record is in sync and each difference.
fn reset()
DESTRUCTIVE. Stop and uninstall k0s on the host and remove its configuration. Re-running on a host with no k0s unit is a clean no-op.
Resources
state(infinite)— Installed k0s cluster state for one host
hostkeys(infinite)— SSH host keys recorded on first use and pinned for every later connection
kubeconfig(infinite)— Admin kubeconfig for one host; the kubeconfig field is sensitive
readiness(infinite)— Readiness evidence for one host
manifests(infinite)— Applied manifest stack state for one host
helm(infinite)— Reconciled Helm charts for one host
status(infinite)— Observed k0s cluster status for one host
Files
config(application/yaml)— Rendered k0s.yaml for one cluster
03Previous Versions
2026.10.17.2
2026.10.17.1
04Stats
A
93 / 100
Downloads
2
Archive size
75.4 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License1/2partial
no SPDX license declared
- Verified public repository2/2earned
deno-command1 accepted
Spawns a subprocess with Deno.Command().
- models/_lib/ssh.ts:505 — no reason given
06Platforms
07Labels