Skip to content

Lab · reference

Lab tasks

You control the virtual lab with mise run lab:<task>. Each task calls one verb of lab/lab.sh. mise puts the pinned tools on the PATH.

Form
mise run lab:<task>
Defined in
mise.toml
Script
lab/lab.sh
Cluster access
.lab/kubeconfig only. No task reads ~/.kube/config.
Unattended tasks
They approve each operation that the operator proposes. Use them only where that is correct.
Task What it does Changes
doctor Checks the workstation. Nothing
render Renders the lab spec. .lab/generated/
up Starts the lab. Workstation, cluster
load Builds the operator again and restarts the manager. Cluster
status Shows the rack and all objects. Nothing
top Shows a live view of each machine. Only when you press a key
approve Approves each operation that waits. Machines
apply Applies manifests as a member of the admin group. Cluster
kubeconfig Writes the access files of the Talos cluster. .lab/
wait Approves and waits for all nodes. Machines
release Deletes one claim and waits for its Host. Machines
day2 Reboots two nodes and makes a change without a reboot. Machines
upgrade Upgrades Talos through a rollout. Machines
scale Adds, removes and replaces nodes. Machines
backup-restore Loses etcd and restores it. Machines
observe Checks the status tables, the metrics and a maintenance window. Cluster
pivot Moves the operator and installs a second cluster. Machines, cluster
collect Writes diagnostics. .lab/diagnostics/
down Stops the lab. Workstation, cluster
reset Deletes the disks of the machines. .lab/state/
  1. Start the lab: mise run lab:up.
  2. Read the proposals: mise run lab:status.
  3. Approve the installs: mise run lab:approve.
  4. Look again until all Hosts are Provisioned: mise run lab:status.
  5. Get the access files: mise run lab:kubeconfig.
  6. Stop the lab: mise run lab:down.

Your first cluster in the lab shows this round with the expected output.

Checks the workstation for all that the lab needs. Each item that is missing prints its fix.

Verb
lab/lab.sh doctor
Reads
PK_LAB_NODES, PK_LAB_WORKLOAD, PK_LAB_SPEC, PK_LAB_MIN_FREE_GIB, PK_LAB_KIND_CONFIG
Changes
Nothing. The sudo check can ask for your password.

The checks are in what the doctor checks.

Renders the lab spec into .lab/generated/. Use it to read the manifests before you start the lab.

Verb
lab/lab.sh render
Reads
PK_LAB_NODES, PK_LAB_WORKLOAD, PK_LAB_SPEC, PK_LAB_TALOS
Changes
The files in rendered files only.

Starts the lab. You can run it again: it uses again what exists, and it applies a changed spec.

Verb
lab/lab.sh up
Runs first
mise run build, which builds metal/bin/pk-metal
Parts
doctor, render, network, cluster, deploy, fleet, manifests. See Parts of up.
Uses sudo
Yes, for the network. See What runs as root.
Refuses
A different size while the fleet runs. A start after pivot, until you run down and reset.
mise run lab:upexample
$ mise run lab:up
ok    go
ok    kind
ok    kubectl
ok    talosctl
ok    yq
ok    jq
ok    curl
ok    docker daemon answers
ok    docker is Docker Engine on this host (not podman, not Docker Desktop)
ok    docker runs as root (rootless Docker is not supported)
ok    /dev/kvm is usable by alice
ok    QEMU (qemu-system-x86_64, /usr/libexec/qemu-kvm or $PK_METAL_QEMU)
ok    OVMF (UEFI firmware for the machines)
ok    https://factory.talos.dev answers (installer images)
ok    the lab spec renders
ok    11264 MiB of available memory for 3 machines
ok    15 GiB free under /home/alice/platform-kit/.lab
the workstation has what the lab needs
== render /home/alice/platform-kit/lab/lab.yaml into /home/alice/platform-kit/.lab/generated
== lab network
  bridge pkbr0
  tap pktap1 (owner alice)
  tap pktap2 (owner alice)
  tap pktap3 (owner alice)
  enable IPv4 forwarding
  firewall rules (forwarding in DOCKER-USER)
== kind cluster pk-metal
Creating cluster "pk-metal" ...
== operator image
== operator deployment (pk-metal:4f2a9c1)
deployment "pk-metal-manager" successfully rolled out
== simulated fleet
  started (pid 48213, log /home/alice/platform-kit/.lab/fleet.log)
  BMC https://10.77.0.1:8441 answers
  BMC https://10.77.0.1:8442 answers
  BMC https://10.77.0.1:8443 answers
== lab manifests
asset.metal.platform-kit.org/node-1 serverside-applied
...
hostclaim.metal.platform-kit.org/node-3 serverside-applied

The lab is up. The operator now enrolls the machines and proposes to boot them.
  watch it:      mise run lab:status
  let it happen: mise run lab:approve     (the one human step)
  afterwards:    mise run lab:kubeconfig
A replay with example data.

After up, the operator proposes one install for each machine. The installs wait for approve.

The operator downloads each installer image from the Talos image factory before it proposes the install. Thus the first approval in top or with pk-metal approve mounts an image that is ready.

Builds the operator image from the working tree, loads it into kind and applies the deployment. Use it after you change the operator code.

Verb
lab/lab.sh deploy
Needs
A lab that is up, and no pivot.
Changes
The image, the CRDs and the Deployment pk-metal-manager

Stops the fleet, deletes the kind cluster and the registry container, and removes the lab network.

Verb
lab/lab.sh down
Keeps
The disks of the machines, the image cache and the Talos secrets bundle.
Deletes
The kubeconfig files and the talosconfig files in .lab/. It keeps the mark file .lab/pivoted.

The fleet turns the machines off before it stops. After 30 seconds, the script stops the fleet with force.

Deletes the state directory of the fleet: the disks and the firmware variables of all machines. The next up installs each machine again.

Verb
lab/lab.sh reset
Needs
A lab that is down.
Safety
It deletes the directory only if it is in .lab/, or if it has the mark file that the lab wrote.
Also deletes
The mark file .lab/pivoted, because no disk holds a moved operator after the wipe.

Shows the output of pk-metal status, then all objects of the operator with kubectl get.

Verb
lab/lab.sh status
Changes
Nothing.

The column BLOCKED shows what each Host, operation and endpoint waits for.

Starts pk-metal top for the lab: one tile for each machine, with its BMC, its virtual machine, its operation and its node.

Verb
None. The task starts metal/bin/pk-metal top --fleet http://127.0.0.1:8440/state.
Runs first
mise run build
Needs
.lab/kubeconfig. With .lab/workload.kubeconfig, it also shows the state of each kubelet.
mise run lab:topexample
All machines are Provisioned. All nodes are Ready. Nothing waits for a person.A replay with example data.
Mark Meaning
● The part is as it must be.
◐ The part changes, or it waits for you.
✗ The part failed or cannot continue.
○ The part is off, or there is nothing.
Key Effect
tab, arrows Select a machine.
a Show the plan of the operation that waits. Approve it only when you press y.
h Put the claim of the machine on hold, or remove the hold.
r Try a failed operation again.
q Stop.
pk-metal top with three tiles. Each machine is Provisioned, and each node is Ready.
A mock screen of lab:top when the lab is complete. The data is an example.

Approves each HostOperation that waits for a person. It runs pk-metal approve --yes for each one.

Verb
lab/lab.sh approve
Acts as
The admin of the kind cluster. The ServiceAccount of the operator cannot approve.
Changes
Machines. An approved install overwrites the install disk.

To read each plan before you approve, use pk-metal approve or the key a in top.

Runs kubectl apply as a member of the group pk-metal:admins. Without arguments, it applies .lab/generated/manifests/.

Verb
lab/lab.sh apply [path...]
Why
The claim policy accepts a claim with spec.os only from that group. The admin of kind is not a member.
Example
mise run lab:apply .lab/generated/manifests/30-claims.yaml

Writes .lab/workload.kubeconfig and .lab/talosconfig from the Secrets that the TalosCluster names.

Verb
lab/lab.sh kubeconfig
Needs
A bootstrapped first control plane.

Writes logs and object lists to .lab/diagnostics/. The directory has no secret values.

Verb
lab/lab.sh collect
Changes
It deletes the old .lab/diagnostics/ and writes a new one.

The files are in diagnostics.

These tasks do the work of the person who approves. Each one checks the result, not only the operation.

Approves each proposal and waits until each Host is Provisioned and each node is Ready.

Verb
lab/lab.sh wait
Time limit
PK_LAB_WAIT_TIMEOUT, default 2400 seconds.
Stops early
When an operation fails, or when the operator cannot build a BootAsset.
Writes
.lab/workload.kubeconfig and .lab/talosconfig
mise run lab:waitexample
$ mise run lab:wait
== waiting up to 2400s for 3 Provisioned hosts and 3 Ready nodes (from 2026-01-15 10:02:10 UTC)
  [2026-01-15 10:02:11 UTC] hosts: 3 Assigned; operations: 3 Running; claims held: none; workload nodes Ready: -
  [2026-01-15 10:02:41 UTC] hosts: 3 Provisioning; operations: 3 Running; claims held: none; workload nodes Ready: -
  [2026-01-15 10:05:26 UTC] hosts: 1 Provisioned, 2 Provisioning; operations: 1 Succeeded, 2 Running; claims held: none; workload nodes Ready: 1
  [2026-01-15 10:06:12 UTC] hosts: 2 Provisioned, 1 Provisioning; operations: 2 Succeeded, 1 Running; claims held: none; workload nodes Ready: 2
converged after 271s: hosts: 3 Provisioned; operations: 3 Succeeded; claims held: none; workload nodes Ready: 3
A replay with example data. Each line has the date, the local time and the time zone.

Deletes one HostClaim, approves the shutdown that the operator proposes, and waits until the Host is Available.

Verb
lab/lab.sh release <namespace/name>
Example
mise run lab:release default/node-3
Time limit
PK_LAB_RELEASE_TIMEOUT, default 900 seconds.

Runs two day-2 rounds on a lab that is complete.

  1. It reboots one worker and one control plane with pk-metal reboot. A second user, lab-proposer, proposes each reboot. The admin approves it.
  2. It checks that the boot ID of each node changed, and that the node is Ready and schedulable.
  3. It adds the label lab.platform-kit.org/day2 to each TalosNode. The operator proposes a Config rollout.
  4. It approves the rollout, continues it after the pause, and checks that no machine rebooted.
Verb
lab/lab.sh day2
Runs first
mise run build
Time limits
PK_LAB_DAY2_TIMEOUT for each reboot, PK_LAB_ROLLOUT_TIMEOUT for the rollout.
One control plane
It sets the annotation metal.platform-kit.org/override-cluster-guard on the reboot operation, in the name of the user of kubectl auth whoami. Without it, the cluster guard holds the reboot.

Upgrades the Talos release of the cluster through an approved TalosRollout.

Verb
lab/lab.sh upgrade
Needs
A lab that started on an older release: PK_LAB_TALOS=v1.14.5 mise run lab:up
Target
cluster.talosVersion in the lab spec.
Time limit
PK_LAB_ROLLOUT_TIMEOUT, default 2400 seconds.
  1. It runs pk-metal upgrade with the target release.
  2. It approves the rollout with pk-metal rollout.
  3. After the first node, the rollout pauses. The task checks that all nodes are Ready. Then it continues the rollout.
  4. It checks that each TalosNode reports the target release.

Runs the scale round on a lab with three control planes and two workers.

Verb
lab/lab.sh scale
Needs
PK_LAB_NODES=3cp+2w, and all nodes Ready.
Uses
pk-metal scale and pk-metal replace
Checks
etcd on each turn: not more than one learner, and not less than the smallest number of voters for that step.
Step Command Result
1 scale lab --control-planes 1 --workers 2 --apply --ack-etcd-risk "lab scale round" 1 etcd voter, 3 nodes
2 scale lab --control-planes 3 --workers 2 --apply 3 etcd voters, 5 nodes
3 scale lab --control-planes 3 --workers 1 --apply 3 etcd voters, 4 nodes
4 replace node-2 --host <host of node-5> --ack-etcd-risk "lab scale round" node-2 runs on a different machine
5 scale lab --control-planes 1 --workers 1 --apply --ack-etcd-risk "lab scale round" 1 etcd voter, 2 nodes

After each removal, the task checks that the Host is Available and has no mark for a disk that was not wiped.

Runs the worst etcd case: all control planes lose their etcd data, and the cluster comes back from a snapshot.

Verb
lab/lab.sh backup-restore
Needs
A lab with all nodes Ready. PK_LAB_NODES=1cp+0w is the quickest.
Uses
pk-metal backup, pk-metal restore, EtcdBackupPolicy, EtcdRecover
Writes
.lab/backup-restore/: an age identity, the snapshot and a kubeconfig for the user lab-restorer
  1. It adds the backup volume to the manager.
  2. It makes an EtcdBackupPolicy with a pvc sink and an age recipient.
  3. It writes the ConfigMap dr-before, takes a snapshot, and writes the ConfigMap dr-after.
  4. It wipes the partition EPHEMERAL on each control plane with talosctl reset.
  5. It waits until the TalosCluster reports EtcdDataLost. The operator does not bootstrap the cluster again.
  6. It proposes the restore as lab-restorer, approves it as the admin, and uploads the snapshot.
  7. It checks that dr-before is back and that dr-after is not.

Checks what a person and a monitoring system see on a lab that is complete. It takes about three minutes.

Verb
lab/lab.sh observe
Status
pk-metal status -o json: each cluster is available and each node is Ready.
Metrics
The operator serves pk_metal_host_phase, pk_metal_talosnode_ready, pk_metal_taloscluster_available, pk_metal_bmc_reachable and pk_metal_credentials_expiry_timestamp_seconds.
Window
A MaintenanceWindow that opens in 120 seconds holds an approved operation. The operation starts after the window opens.

The operation ejects an empty virtual media slot, so it changes nothing on the machine.

Moves the operator from kind to the first Talos cluster, deletes kind, and installs a second cluster from there.

Verb
lab/lab.sh pivot
Needs
A second cluster in the spec (PK_LAB_WORKLOAD), and a first cluster with all nodes Ready.
Uses
pk-metal pivot with --media-store ephemeral
Writes
.lab/second.kubeconfig, .lab/second.talosconfig and the mark file .lab/pivoted
  1. It starts an image registry at 10.77.0.1:5000 and pushes the operator image.
  2. It runs pk-metal pivot --to .lab/workload.kubeconfig.
  3. It deletes the kind cluster. .lab/kubeconfig now names the first Talos cluster.
  4. It applies .lab/generated/workload/, approves, and waits for the nodes of the second cluster.

If the task fails, run it again. It continues where it stopped.

For a partial run, call a part directly. Each part uses the files that the last up rendered.

Verb What it does
lab/lab.sh network Makes the bridge, the taps and the firewall rules.
lab/lab.sh cluster Makes the kind cluster, or starts its node container again.
lab/lab.sh deploy Builds and deploys the operator. The task load calls this verb.
lab/lab.sh fleet Starts the simulated fleet and waits until each BMC answers.
lab/lab.sh manifests Applies .lab/generated/manifests/ as a member of the admin group.