Skip to content

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.

Three changes in order: a reboot of one worker, a configuration change without a reboot, and a Talos upgrade. Each one waits for an approval.1. Rebootone HostOperation2. Config changerollout, no reboot3. Talos upgraderollout, node by node
The three changes of this tutorial. Each one waits for an approval.
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. If a lab runs, stop it and delete the disks.

    Terminal window
    mise run lab:down && mise run lab:reset
  2. Start the lab one Talos release behind. See PK_LAB_TALOS.

    Terminal window
    PK_LAB_TALOS=v1.14.5 mise run lab:up
  3. Approve the installs and wait.

    Terminal window
    mise run lab:wait
  4. 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.

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.

  1. 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
  2. Propose the reboot as that user.

    Terminal window
    metal/bin/pk-metal --kubeconfig .lab/proposer.kubeconfig reboot node-2
    Terminal 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-x7k2p
    To withdraw it: pk-metal abort pk-metal/reboot-node-2-x7k2p
  3. 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
  4. 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”
  1. 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; do
    kubectl patch talosnode "$node" --type merge \
    --patch '{"spec":{"labels":{"lab.platform-kit.org/day2":"tutorial"}}}'
    done
  2. Wait until the operator proposes a rollout. This can take some minutes.

    Terminal window
    metal/bin/pk-metal rollout list
  3. 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.

  4. Approve the plan.

    Terminal window
    metal/bin/pk-metal rollout approve <rollout>
  5. The rollout pauses after the first node. Make sure that the node is Ready.

  6. Continue the rollout.

    Terminal window
    metal/bin/pk-metal rollout resume <rollout>

See TalosRollout, pk-metal rollout and Day-2 change.

  1. 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.6
    Terminal window
    cluster lab now asks for Talos v1.14.6 (was v1.14.5); nothing on a machine changed yet

    The command then shows the rollout that the operator proposes.

  2. Read the plan. Each step shows v1.14.5 -> v1.14.6 and REBOOTS.

    Terminal window
    metal/bin/pk-metal rollout show <rollout>
  3. Approve the plan.

    Terminal window
    metal/bin/pk-metal rollout approve <rollout>
  4. 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 wide

    The column BLOCKED shows ClusterDisruption. The cluster guard holds the operation, because the cluster has no second control plane.

  5. 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-1 restarts.

  6. After the first node, the rollout pauses. Make sure that all nodes are Ready.

    Terminal window
    kubectl --kubeconfig .lab/workload.kubeconfig get nodes
  7. 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.

  • 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.