Skip to content

Tutorial

Scaling in the lab

In this tutorial, you change the size of a cluster that runs. You tell the operator the size that you want. The operator proposes one operation for each machine.

The cluster goes from three control planes and two workers to one control plane, back to three, then to one worker, then node-2 moves to a different machine.3 cp + 2 wstart1 cp + 2 wstep 23 cp + 2 wstep 33 cp + 1 wstep 4node-2 movesstep 5
The sizes of the cluster in this tutorial. etcd has not more than one learner at a time.
  • A cluster that lost two control planes and got them back, one at a time.
  • A worker that left the cluster. Its machine is Available again, with a wiped disk.
  • A control plane that moved to a different machine.
Time
About 90 minutes.
Before
Your first cluster in the lab
Memory
About 19 GiB free, for five machines. See memory. For less memory, see On a workstation with 16 GB.
Lab
Down. Step 1 starts a lab with five machines.

The unattended task mise run lab:scale does all steps without your hands, and it examines etcd on each turn.

mise run lab:scaleexample
$ mise run lab:scale
== scale lab to 1 control plane
cluster lab: 3 control plane(s) and 2 worker(s) now, 1 and 2 wanted
== scale to 1 control plane: waiting up to 2400s for 1 etcd voter(s) and 3 Ready node(s)
  [2026-01-15 10:31:15 UTC] etcd: 3 voter(s), 0 learner(s); nodes: 5 of 5 Ready; ...
  [2026-01-15 10:35:40 UTC] etcd: 2 voter(s), 0 learner(s); nodes: 4 of 4 Ready; ...
  done after 562s: 1 etcd voter(s), 3 Ready node(s)
== scale lab to 3 control planes
  [2026-01-15 10:44:02 UTC] etcd: 1 voter(s), 1 learner(s); nodes: 3 of 4 Ready; ...
  done after 733s: 3 etcd voter(s), 5 Ready node(s)
== remove worker node-5
  done after 148s: 3 etcd voter(s), 4 Ready node(s)
== replace control plane node-2 onto Host pklab0005
== replace a control plane: releasing Host pklab0002
  done after 604s: 3 etcd voter(s), 4 Ready node(s)
== scale lab back to 1 control plane
  done after 498s: 1 etcd voter(s), 2 Ready node(s)
the scale round finished: lab has 1 control plane and 1 worker
A replay of lab:scale with example data. The lines are shorter than the real lines.
  1. If a lab runs, stop it and delete the disks.

    Terminal window
    mise run lab:down && mise run lab:reset
  2. Start the lab with three control planes and two workers. See PK_LAB_NODES.

    Terminal window
    PK_LAB_NODES=3cp+2w mise run lab:up
    mise run lab:wait
  3. Set the kubeconfig and the talosconfig for this terminal.

    Terminal window
    export KUBECONFIG=$PWD/.lab/kubeconfig
    export TALOSCONFIG=$PWD/.lab/talosconfig
  4. Write a kubeconfig for a member of the admin group. The admin of kind is not a member.

    Terminal window
    yq '.users[].user.as = "lab-admin"
    | .users[].user."as-groups" = ["system:masters", "pk-metal:admins", "system:authenticated"]' \
    .lab/kubeconfig > .lab/admin.kubeconfig

    Only a member of the admin group can make a claim that installs a node. The same is true when a claim moves to a different machine. See Admission policies. The file uses impersonation, which is a shortcut of the lab. On a real site, your login gives you the group.

  1. Show the plan. Without --apply, the command changes nothing.

    Terminal window
    metal/bin/pk-metal scale lab --control-planes 1 --workers 2
    Terminal window
    cluster lab: 3 control plane(s) and 2 worker(s) now, 1 and 2 wanted

    The plan lists the claims that it deletes, and it tells you about the etcd risk.

  2. Apply the plan. On the way, etcd has two members. Give a reason to accept this risk.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/admin.kubeconfig scale lab \
    --control-planes 1 --workers 2 --apply --ack-etcd-risk "lab tutorial"
  3. Approve the operations that the operator proposes.

    Terminal window
    mise run lab:approve
  4. Do step 3 again until mise run lab:status shows no operation that waits. The control planes leave one at a time.

The operations use EtcdLeave, Drain and TalosReset. See pk-metal scale.

  1. Apply the larger size as the admin. The command makes claims that install a node.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/admin.kubeconfig scale lab \
    --control-planes 3 --workers 2 --apply
    Terminal window
    created claim default/node-2
    created claim default/node-3
    The operator proposes the operations; approve each with: pk-metal approve
  2. Approve the installs as they come. The operator adds one control plane at a time.

    Terminal window
    mise run lab:approve
  3. Watch etcd. A new member is a learner first. Then it becomes a voter.

    Terminal window
    talosctl --nodes 10.77.0.11 etcd members
  1. Apply the size with one worker. The operator removes node-5.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/admin.kubeconfig scale lab \
    --control-planes 3 --workers 1 --apply
  2. Approve the operation.

    Terminal window
    mise run lab:approve
  3. Wait until the Host of node-5 is Available.

    Terminal window
    kubectl get host pklab0005

See Release a host and Release and reuse.

You move node-2 from the Host pklab0002 to the free Host pklab0005, as you do when hardware fails.

  1. Tell the claim to use the new Host, as the admin.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/admin.kubeconfig replace node-2 \
    --host pklab0005 --ack-etcd-risk "lab tutorial"
    Terminal window
    claim default/node-2 now selects host pklab0005 (asset node-5); it ran on host pklab0002.
  2. Approve the release of the old machine. Wait until pklab0002 is Available.

    Terminal window
    mise run lab:approve
    kubectl get host pklab0002
  3. Change the disk and the network link of the TalosNode to the values of the new machine.

    Terminal window
    kubectl patch talosnode node-2 --type json --patch '[
    {"op": "replace", "path": "/spec/installDiskSelector/serial", "value": "pklab-disk-5"},
    {"op": "replace", "path": "/spec/network/links/0/hardwareAddr", "value": "52:54:00:77:00:15"}]'
  4. Approve the install on the new machine.

    Terminal window
    mise run lab:approve

The values come from the machine number. See lab.yaml. For a real site, see Replace a node and pk-metal replace.

If a step does not give its checkpoint, see Lab troubleshooting.

  1. Stop the lab and delete the disks.

    Terminal window
    mise run lab:down && mise run lab:reset

The default shape of five machines needs about 19 GiB. You can give each machine less memory.

  1. Copy lab/lab.yaml to lab-small.yaml.

  2. In the copy, set controlPlane.memoryMiB to 2048 and worker.memoryMiB to 1024.

  3. In step 1, start the lab with the copy.

    Terminal window
    PK_LAB_SPEC=$PWD/lab-small.yaml PK_LAB_NODES=3cp+2w mise run lab:up
  4. Keep PK_LAB_SPEC set in the terminal for all mise run lab:* commands of this tutorial.

The doctor then asks for 11264 MiB. The doctor names these values as the smallest for Talos. The installs and the etcd changes are slower. The end-to-end test does not run this shape.

  • You give the size. The operator finds the machines and the order: pk-metal scale.
  • Control planes join and leave one at a time, so that etcd keeps a majority.
  • A removed machine comes back to the pool with a wiped disk: Release and reuse.
  • A replace releases the old machine first. Then it installs the node on the new machine.