Skip to content

Lab · reference

Virtual lab

The virtual lab runs the operator and a small rack of machines on one workstation. The machines are real UEFI machines in QEMU, and the install is a real Talos install. Only the hardware is simulated.

Start
mise run lab:up
Default size
One control plane and two workers. Change it with PK_LAB_NODES.
Management cluster
A kind cluster with the name pk-metal. It runs the operator.
Machines
node-1, node-2, and so on. Each one is a QEMU virtual machine with a simulated BMC.
Network
The bridge pkbr0 with 10.77.0.0/24. See Lab network.
State
The directory .lab/. Git ignores it. The lab does not read or write ~/.kube/config.
Root
Only lab/net.sh uses sudo. See What runs as root.
Source
lab/lab.sh
The virtual lab on one workstation. The operator runs in a kind cluster. A fleet process serves one simulated BMC for each QEMU virtual machine. The bridge pkbr0 connects them.Workstation or CI runnerkind cluster pk-metalpk-metal-managerthe operator podMedia storeNodePort 30443pk-metal sim fleetBMC node-110.77.0.1:8441BMC node-210.77.0.1:8442BMC node-310.77.0.1:8443State endpoint127.0.0.1:8440/stateQEMU virtual machinesnode-110.77.0.11node-210.77.0.12node-310.77.0.13Cluster VIP10.77.0.10Redfishboot mediapower, mediaBridge pkbr010.77.0.1/24 · one tap for each machine: pktap1, pktap2, pktap3Talos API, Kubernetes APIlistens ontaps.lab/disks, logs, kubeconfig, generated filesNAT to the outsideimages, DNS, time
The virtual lab at the default size. Only the hardware is simulated.
Kind cluster pk-metal
The management cluster. It has one node, a container on the workstation. lab/kind.yaml defines it.
Operator pod
The Deployment pk-metal-manager in the namespace pk-metal. The lab builds its image from the working tree. See Manager.
Media store
The operator serves boot media on port 8443. The NodePort 30443 publishes it at https://10.77.0.1:30443, on the bridge address only.
Simulated fleet
One pk-metal sim fleet process on the workstation. It serves one BMC for each machine, at 10.77.0.1:8441 and up. See pk-metal sim.
QEMU virtual machines
One for each BMC. A BMC starts and stops its virtual machine and gives it the virtual media. Machine n has the address 10.77.0.<10+n>.
Cluster VIP
10.77.0.10. The control planes share this address for the Kubernetes API.
Bridge pkbr0
The workstation has the address 10.77.0.1 on it. Each machine connects through one tap. The machines go to the outside through NAT.
Part In the lab At a real site
Operator image and manifests The same The same
Approval step The same: pk-metal approve The same
Talos install and cluster The same The same
Machine QEMU virtual machine with OVMF Server
BMC Simulated Redfish service BMC of the server
Management cluster kind A small cluster, then the cluster after a pivot

mise run lab:up runs seven parts in order. You can run it again. It continues where it stopped.

The parts of lab:up

1 / 7

lab:up runs seven parts in order: doctor, render, network, cluster, deploy, fleet and manifests. Each part makes one thing.doctorChecksno changerenderFiles.lab/generatednetworkpkbr0and the tapsclusterkindpk-metaldeployOperatorand the CRDsfleetBMCsand the VMsmanifestsObjectsAssets, claims

Check the workstation

The doctor checks the tools, KVM, Docker, memory and disk. Each check that fails prints its fix. The doctor changes nothing.

lab/lab.sh doctor
  1. Check the workstation. The doctor checks the tools, KVM, Docker, memory and disk. Each check that fails prints its fix. The doctor changes nothing.

    lab/lab.sh doctor
  2. Render the spec. The renderer reads lab/lab.yaml and writes the fleet file, the manifests, the tap list and the ledger into .lab/generated.

    lab/lab.sh render
  3. Make the network. lab/net.sh makes the bridge pkbr0, one tap for each machine and the firewall rules. This is the only part that uses sudo.

    lab/lab.sh network
  4. Start the management cluster. kind starts one node. The media port 30443 is published on the bridge address only.

    lab/lab.sh cluster
  5. Deploy the operator. The script builds the operator image from the working tree and loads it into kind. Then it applies the CRDs and the manager Deployment.

    lab/lab.sh deploy
  6. Start the simulated fleet. One pk-metal process serves a BMC for each machine. The script waits until each BMC answers.

    lab/lab.sh fleet
  7. Apply the manifests. The script applies the Assets, the TalosCluster, the TalosNodes and the HostClaims. The operator proposes one install for each machine. The installs wait for you.

    lab/lab.sh manifests
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 of lab:up with example data. The output is shorter than the real output.

After the last part, the operator enrolls the machines and proposes one install for each machine. No machine changes before you approve. See Approval.

All files are below .lab/. Set PK_LAB_DIR to move the directory.

Path Contents
generated/ The files that mise run lab:render writes from lab/lab.yaml. Do not edit them.
kubeconfig The kubeconfig of the management cluster.
workload.kubeconfig, talosconfig The access files of the Talos cluster. mise run lab:kubeconfig writes them.
deploy/ The generated deployment of the operator and the Talos secrets bundle.
state/<machine>/ The disk, the firmware variables and console.log of each machine.
cache/ Installer images. The fleet downloads each image one time.
fleet.log, fleet.pid The log and the process ID of the simulated fleet.
diagnostics/ The output of mise run lab:collect.