Tutorial
First real server
In the virtual lab, the machines are simulated BMCs and virtual machines. In this tutorial you use one real server. At the end, the server runs Talos as a cluster with one control plane.
What you make
Section titled “What you make”- A management cluster in kind on your workstation, with the operator.
- One Host for your server, found through its BMC.
- One Talos cluster,
first, with one node,cp-1, that isReady.
Time and prerequisites
Section titled “Time and prerequisites”- Time
- About one hour. The install takes about ten minutes.
- Hardware
- One x86-64 server in UEFI boot mode, with a Redfish BMC that has the license for virtual media. One free static address for the node. See Supported hardware.
- Network
- Your workstation reaches the BMC on TCP 443. The BMC reaches your workstation on TCP 30443. The node reaches the internet.
- BMC network
- The BMC downloads the installer and the config from the media service of the operator. The operator downloads the installer from
factory.talos.dev. See The BMC and the image factory. - Tools
- A Linux workstation with Docker Engine and a clone of the repository.
mise installgives you kind, kubectl and talosctl.eval "$(mise activate bash)"puts them on thePATH. Stage 1 buildspk-metal. - Knowledge
- Read Your first cluster in the lab first. This tutorial uses the same steps.
1. Check the BMC
Section titled “1. Check the BMC”-
Build the tool, and put it on your
PATH.Terminal window mise run build && export PATH=$PWD/metal/bin:$PATH -
Put the BMC password in the environment.
Terminal window read -rs PK_METAL_BMC_PASSWORD && export PK_METAL_BMC_PASSWORD -
Check the BMC.
Terminal window pk-metal check --insecure https://192.0.2.21 -
Count the
media:lines that do not showdialect=none. One such line means a BMC with one slot. -
Read the inventory into a file.
Terminal window pk-metal inventory --insecure --node cp-1 https://192.0.2.21 > cp-1-inventory.yaml -
Write down these values: the serial number, the BMC MAC, the node NIC MAC and the install disk serial.
Checkpoint. The last line of the check is check: OK (read-only). See Check a BMC to read the other lines.
2. Start the operator
Section titled “2. Start the operator”This stage is a short form of Install the operator. That page explains each file.
-
Copy
lab/kind.yamltokind.yaml. SetlistenAddressto the address of your workstation on the BMC network. -
Make the kind cluster.
Terminal window kind create cluster --config kind.yaml -
Build the operator image. The last line of the output is the image reference, for example
pk-metal:4f0c2d1a9b3e.Terminal window mise run image -
Load the image into kind. Use your image reference.
Terminal window kind load docker-image pk-metal:4f0c2d1a9b3e --name pk-metal -
Copy the sample overlay.
Terminal window cp -r metal/config/samples/site-overlay overlay -
In
overlay/kustomization.yaml, set the base to../metal/config/default. SetimagestonewName: pk-metalandnewTagto your tag. -
In
overlay/manager_args.yaml, set--media-url=https://<workstation address>:30443. -
In
overlay/ledger.yaml, write one line: the BMC MAC andhttps://192.0.2.21. Delete the example lines. -
Decide how the manager checks the BMC certificate. See BMC certificates. For this first test on a closed BMC network, you can remove
--bmc-ca-secret=bmc-ca. The manager then pins the key that the BMC shows at the first contact. -
If the BMC has one slot, remove the comment marks from
componentsinoverlay/kustomization.yaml. -
Apply the overlay.
Terminal window kubectl apply --server-side -k overlay
Checkpoint. kubectl -n pk-metal get pods shows the manager as Running.
3. Enroll the server
Section titled “3. Enroll the server”-
Make the credentials Secret.
Terminal window kubectl -n pk-metal create secret generic bmc-factory \--from-literal=username=admin --from-literal=password="$PK_METAL_BMC_PASSWORD" -
Write and apply the Asset, with the serial and the BMC MAC from stage 1.
Terminal window kubectl apply -f asset.yaml -
Monitor the Host.
Terminal window kubectl get hosts -w
Checkpoint. One Host is Available. If it shows Mismatch, see Host in Mismatch.
If no Host comes and kubectl get managementendpoints shows Unreachable, the cause is usually the BMC certificate. See BMC unreachable.
4. Define the cluster
Section titled “4. Define the cluster”-
Make the secrets bundle and put it into a Secret.
Terminal window talosctl gen secrets -o secrets.yaml -
Make the Secret from the file.
Terminal window kubectl -n pk-metal create secret generic first-talos-secrets --from-file=secrets.yaml -
Write a TalosCluster
first. Use the node address as the endpoint. SetcontrolPlane.allowScheduling: true, so that pods can run on the one node. -
Write a TalosNode
cp-1with the rolecontrolplane, the disk serial and the NIC MAC from stage 1. -
Apply both files.
Terminal window kubectl apply -f first.yaml -
Wait until the operator rendered the config.
Terminal window kubectl wait --for=condition=Rendered talosnode/cp-1 --timeout=120s
Checkpoint. The command prints talosnode.os.platform-kit.org/cp-1 condition met. See Define a cluster for the fields.
5. Claim and install
Section titled “5. Claim and install”Install one machine
1 / 5
Claim
You apply a HostClaim. The HostClaim controller binds a free Host to it.
kubectl apply -f claim.yamlClaim. You apply a HostClaim. The HostClaim controller binds a free Host to it.
kubectl apply -f claim.yamlPropose. The controller proposes a HostOperation. The operation waits for approval. The machine does not change.
pk-metal statusApprove. You approve the operation. The HostOperation controller starts it.
pk-metal approve install-node-01Boot. The operation mounts the installer and the node configuration as virtual media. It sets a one-time boot device and power cycles the machine.
InsertMedia → SetBootOverride → PowerCycleCheck in. Talos starts from the disk and the node checks in. The operation ejects the media and succeeds. The Host is Provisioned.
AwaitCheckIn → EjectMedia
-
Write a HostClaim
cp-1with the Asset andspec.os.nodeRef.name: cp-1. -
Apply it as a member of the admin group. Only that group can apply a claim that installs a node, and the kind admin is not a member.
Terminal window kubectl apply --as="$USER" --as-group=pk-metal:admins --as-group=system:authenticated -f claim.yamlThis command uses impersonation. It is a shortcut for a test cluster of your own. On a production cluster, your login gives you the group. See The admin group and the approvers.
-
List the operations that wait. Without a name, the command approves nothing.
Terminal window pk-metal approve -
Read the plan of the install and approve it. Use the name from the list. Type
ywhen the command asks.Terminal window pk-metal approve pk-metal/<name>The operator proposed the install, so you can approve it.
-
Monitor the Host and the serial console of the server.
Terminal window kubectl get hosts -w
Checkpoint. The Host is Provisioned. kubectl get taloscluster first shows AVAILABLE True.
6. Use the cluster
Section titled “6. Use the cluster”-
Write the kubeconfig to a file.
Terminal window kubectl -n pk-metal get secret first-kubeconfig -o jsonpath='{.data.kubeconfig}' | base64 -d > first.kubeconfig -
Show the node.
Terminal window kubectl --kubeconfig first.kubeconfig get nodes
Checkpoint. cp-1 is Ready.
If a stage does not give its checkpoint
Section titled “If a stage does not give its checkpoint”| What you see | Go to |
|---|---|
The manager pod is not Running |
If it fails of the install how-to |
The endpoint is Unreachable |
BMC unreachable |
The operation fails at insertMedia |
Media slot busy or missing, and The BMC and the image factory |
The Host stays Provisioning, and the console shows no boot |
Node not ready, and the boot mode in Supported hardware |
The operation is Failed |
Operation failed |
What you learned
Section titled “What you learned”- The operator finds a machine through its BMC and the ledger: Ledger, Identity.
- It boots from virtual media, not PXE: Virtual media boot.
- It changes a machine only after your approval: Approval.
- Give the machine back: Release a host. The release wipes the disk.
- Move the operator onto a cluster that it built: Pivot the operator.
- Install more machines: Install hosts.