Tutorial
Day 2 in the lab
In this tutorial, you do three day-2 changes on a cluster that runs. Each change is a proposal. Nothing happens to a machine before a person approves it.
What you make
Section titled “What you make”- A worker that rebooted cleanly: cordon, drain, reboot, uncordon.
- A node label on all nodes, applied without a reboot.
- A cluster on a newer Talos release.
Time and prerequisites
Section titled “Time and prerequisites”- Time
- About 45 minutes.
- Before
- Your first cluster in the lab
- Lab
- Down, or not started. Step 1 starts it on an older Talos release.
The unattended tasks mise run lab:day2 and mise run lab:upgrade do the same changes without your hands.
1. Start a lab on an older release
Section titled “1. Start a lab on an older release”-
If a lab runs, stop it and delete the disks.
Terminal window mise run lab:down && mise run lab:reset -
Start the lab one Talos release behind. See
PK_LAB_TALOS.Terminal window PK_LAB_TALOS=v1.14.5 mise run lab:up -
Approve the installs and wait.
Terminal window mise run lab:wait -
Set the kubeconfig of the management cluster for this terminal.
Terminal window export KUBECONFIG=$PWD/.lab/kubeconfig
If a step does not give its checkpoint, see Lab troubleshooting.
2. Reboot a worker
Section titled “2. Reboot a worker”The lab forbids self-approval (selfApproval: Forbidden): the person who proposes a change cannot approve it. The lab has one admin, so you make a second user.
-
Write a kubeconfig for the user
lab-proposer.Terminal window yq '.users[].user.as = "lab-proposer"| .users[].user."as-groups" = ["system:masters", "system:authenticated"]' \.lab/kubeconfig > .lab/proposer.kubeconfig -
Propose the reboot as that user.
Terminal window metal/bin/pk-metal --kubeconfig .lab/proposer.kubeconfig reboot node-2Terminal window proposed pk-metal/reboot-node-2-x7k2p: a clean reboot of TalosNode node-2 on host pklab0002 (5 steps).Approve it after reading the plan (another person must, if the site forbids self-approval): pk-metal approve pk-metal/reboot-node-2-x7k2pTo withdraw it: pk-metal abort pk-metal/reboot-node-2-x7k2p -
Read the plan and approve it as the admin. Use the name from your output.
Terminal window metal/bin/pk-metal approve pk-metal/reboot-node-2-x7k2p -
Watch the operation until its phase is
Succeeded.Terminal window kubectl -n pk-metal get hostoperations --watch
The actions are Cordon, Drain, TalosReboot, WaitNodeReady and Uncordon. See pk-metal reboot.
3. Change the configuration without a reboot
Section titled “3. Change the configuration without a reboot”-
Add a label to each TalosNode. No policy guards this change. The rollout that follows needs the approval.
Terminal window for node in node-1 node-2 node-3; dokubectl patch talosnode "$node" --type merge \--patch '{"spec":{"labels":{"lab.platform-kit.org/day2":"tutorial"}}}'done -
Wait until the operator proposes a rollout. This can take some minutes.
Terminal window metal/bin/pk-metal rollout list -
Read the plan. Use the name from the list.
Terminal window metal/bin/pk-metal rollout show <rollout>Each step of the plan ends with
no reboot. -
Approve the plan.
Terminal window metal/bin/pk-metal rollout approve <rollout> -
The rollout pauses after the first node. Make sure that the node is
Ready. -
Continue the rollout.
Terminal window metal/bin/pk-metal rollout resume <rollout>
See TalosRollout, pk-metal rollout and Day-2 change.
4. Upgrade Talos
Section titled “4. Upgrade Talos”-
Set the release that the cluster asks for. The target is the release in
lab/lab.yaml.Terminal window metal/bin/pk-metal upgrade talos lab v1.14.6Terminal window cluster lab now asks for Talos v1.14.6 (was v1.14.5); nothing on a machine changed yetThe command then shows the rollout that the operator proposes.
-
Read the plan. Each step shows
v1.14.5 -> v1.14.6andREBOOTS.Terminal window metal/bin/pk-metal rollout show <rollout> -
Approve the plan.
Terminal window metal/bin/pk-metal rollout approve <rollout> -
Show the operations of the rollout. The first one is for
node-1, the only control plane.Terminal window kubectl -n pk-metal get hostoperations -l os.platform-kit.org/rollout=<rollout> -o wideThe column
BLOCKEDshowsClusterDisruption. The cluster guard holds the operation, because the cluster has no second control plane. -
Lift the guard for this operation. The value is your username and your reason. Use the name of the operation from step 4.
Terminal window me=$(kubectl auth whoami -o jsonpath='{.status.userInfo.username}')kubectl -n pk-metal annotate hostoperation <operation> \metal.platform-kit.org/override-cluster-guard="$me: the cluster has one control plane"The Kubernetes API of the lab cluster does not answer while
node-1restarts. -
After the first node, the rollout pauses. Make sure that all nodes are
Ready.Terminal window kubectl --kubeconfig .lab/workload.kubeconfig get nodes -
Continue the rollout.
Terminal window metal/bin/pk-metal rollout resume <rollout>
The rollout does the control plane first, then the workers. The action is TalosUpgrade. See pk-metal upgrade and Upgrade Talos.
What you learned
Section titled “What you learned”- A day-2 change is a proposal that waits for a person: Approval.
- Two persons are necessary: one proposes, one approves.
- A rollout changes one node at a time, and it pauses after the first node: TalosRollout.
- The operator finds if a configuration change needs a reboot. The plan shows it.