Skip to content

Tutorial

Your first cluster in the lab

In this tutorial, you start the virtual lab and approve the install of three machines. The result is a Kubernetes cluster that the operator installed through simulated BMCs.

pk-metal top with three tiles. Each machine is Provisioned, and each node is Ready.
The end of this tutorial, as lab:top shows it. A mock screen with example data.

Virtual lab shows what runs where.

Time
About 15 minutes. The first start downloads the images and takes more time.
Workstation
Linux with KVM, Docker Engine, 12 GiB of free memory and 15 GiB of free disk.
Packages
See Lab prerequisites.
Repository
A clone of the repository. Run all commands in its root directory.
  1. Install mise. It installs the tools at the versions that the repository pins.

  2. Trust the configuration of the repository.

    Terminal window
    mise trust
  3. Install the pinned tools.

    Terminal window
    mise install
  4. Put the tools on the PATH of this terminal. Do this in each new terminal.

    Terminal window
    eval "$(mise activate bash)"

    Without this step, kubectl, talosctl, kind and yq are available only in mise run tasks.

  5. Run the doctor. The doctor can ask for your sudo password. It runs nothing as root.

    Terminal window
    mise run lab:doctor
  6. If a line starts with MISS, do what its fix: line says. Then run the doctor again.

  1. Start the lab.

    Terminal window
    mise run lab:up
  2. Type your password if sudo asks for it. Only the network part uses sudo.

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. Your output has more lines.
  1. Show the state of the rack.

    Terminal window
    mise run lab:status
  2. Find the three operations with the phase AwaitingApproval.

  3. Read the plan of each operation.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/kubeconfig approve

    Without a name, the command lists the operations that wait. It approves nothing.

  1. Open the live view in a second terminal.

    Terminal window
    mise run lab:top
  2. Select a machine with tab.

  3. Press a. Read the plan.

  4. Press y to approve.

  5. Do steps 2 to 4 again for the other two machines.

  6. If an operation fails at insertMedia, select the machine and press r.

The approval dialog of pk-metal top. It shows nine steps: eject media, mount the installer and the machine config, set the boot device, power cycle, wait for the node, eject media.
The plan of one install in lab:top. A mock screen with example data.

To approve all operations at one time, you can use mise run lab:approve. See mise run lab:approve.

  1. Keep the live view open. Each tile shows the step of its operation, for example 7/9 awaitCheckIn.
  2. Wait until each Host is Provisioned. This takes about three minutes after the approval.
  3. If an operation fails, press r in the live view to try it again. pk-metal retry does the same.
mise run lab:topexample
All machines are Provisioned. All nodes are Ready. Nothing waits for a person.A replay of lab:top with example data.

The control plane, node-1, installs first. The workers join after the control plane is bootstrapped. Rack to running node explains each step.

  1. Stop the live view with q.

  2. Write the access files.

    Terminal window
    mise run lab:kubeconfig
  3. Show the nodes.

    Terminal window
    kubectl --kubeconfig .lab/workload.kubeconfig get nodes
    Terminal window
    NAME STATUS ROLES AGE VERSION
    node-1 Ready control-plane 6m v1.36.2
    node-2 Ready <none> 4m v1.36.2
    node-3 Ready <none> 4m v1.36.2
  4. Show the Hosts in the management cluster.

    Terminal window
    kubectl --kubeconfig .lab/kubeconfig get hosts
  1. Stop the lab. The command uses sudo to remove the lab network.

    Terminal window
    mise run lab:down
  2. Delete the disks of the machines.

    Terminal window
    mise run lab:reset

lab:down deletes the kind cluster, and with it all objects of the operator. It keeps the disks and the secrets bundle. If you do not delete the disks, the next lab:up starts the same machines, and the operator proposes the installs again. Each of the other lab tutorials starts a new lab of its own.

If a step does not give its checkpoint, see Lab troubleshooting. mise run lab:collect writes the state of the lab to a directory.