Command · pk-metal
pk-metal pivot
changes machinesneeds the cluster
pk-metal pivot moves the operator from the cluster that it runs in to a different cluster.
The usual case: the operator ran in a kind cluster and installed a Talos cluster. Now it moves onto that Talos cluster.
Nothing on the machines changes. The operator in the source cluster stops, and its objects stay there.
Synopsis
Section titled “Synopsis”pk-metal pivot --to <kubeconfig> [--to-context name] [--yes] [flags]The command takes no arguments. The Global flags select the source cluster. --to selects the target cluster.
| Flag | Default | Description |
|---|---|---|
--force-waiting | false | Move operations that wait for approval; they wait on the new cluster instead. |
--image<string> | - | Manager image on the new cluster (default: the image the operator runs now). |
--media-store<string> | copy | What the media store becomes on the new cluster: copy (a claim made there from its StorageClass, or the one already there) or ephemeral (an emptyDir: no installer for a one-slot BMC is built there). |
--media-url<string> | - | Address the BMCs fetch boot media from on the new cluster, for example https://<node address>:30443 (default: the current one). |
--settle<duration> | 1m30s | How long to watch the new operator for operations it must not propose. |
--timeout<duration> | 5m0s | How long to wait for each step. |
--to<string>required | - | Kubeconfig file of the cluster to move to. |
--to-context<string> | - | Context in the --to kubeconfig (default: its current context). |
--yes | false | Move without asking (for scripts); the checks are still printed. |
This command also accepts the global flags --kubeconfig and --context.
What it does
Section titled “What it does”The steps have the names of the steps in Pivot the operator.
- Preflight. No operation runs or waits for approval, and the target cluster runs no operator. The command prints what the target cluster must reach, and asks
Move? [y/N]. - Pause. It sets the operator in the source cluster to zero replicas and waits until it stops.
- Install. It installs the operator in the target cluster: CRDs, admission policies, RBAC, the namespace and the claim for the media store.
- Copy. It copies the objects of the operator with their status, and the Secrets in the namespace
pk-metal. - Start. It starts the operator in the target cluster.
- Settle. For the time of
--settle, it makes sure that the new operator proposes no new operation.
The command cannot test the network. Before you answer, make sure that the target cluster can reach the BMCs, the Talos API and the media service.
If the command fails, run it again. It continues where it stopped.
The media store
Section titled “The media store”The media store holds the installers for BMCs with one virtual media slot. Its files do not move. The new operator builds the installers again.
--media-store=copy- The default. The target cluster needs the claim, or a default StorageClass to make it. Without storage, the command refuses.
--media-store=ephemeral- The operator mounts an
emptyDir. It starts empty, and each restart deletes it. The operator builds no installer for a one-slot BMC until the claim exists.
Operations that wait
Section titled “Operations that wait”The check refuses when an operation waits for approval. With --force-waiting, the command moves such operations, and they wait in the target cluster.
Examples
Section titled “Examples”pk-metal --context kind-pk-metal pivot --to mgmt.kubeconfig
pk-metal pivot: move the operator from kind-pk-metal to admin@lab
From admin@lab, the operator must reach (pivot cannot test this):
...
The operator on kind-pk-metal stops now. No machine is touched.
Move? [y/N] y
paused the manager on kind-pk-metal
installed 17 CRDs
installed the operator in namespace pk-metal (Deployment pk-metal-manager at 0 replicas)
started the manager on admin@lab (1 replica)
the manager on admin@lab settled: no new operation in 1m30s
The operator runs on admin@lab now.
To move back, run the command from the new cluster with --to set to the kubeconfig of the old cluster.
pk-metal --kubeconfig mgmt.kubeconfig pivot --to kind.kubeconfigObjects
Section titled “Objects”| Object | Source cluster | Target cluster |
|---|---|---|
| Deployment of the operator | Set to zero replicas. | Made, then started. |
| CRDs, admission policies, RBAC, namespace | Read. | Made. |
| All kinds of the operator, for example Host, HostClaim, HostOperation and TalosCluster | Read. They stay. | Made, with their status. |
Secrets in pk-metal |
Read. | Made. |
| PersistentVolumeClaim of the media store | Not moved. | Made empty, or an emptyDir. |
If the target cluster holds an older copy of the objects, the command removes the objects that the source cluster no longer has.
Who writes on the target
Section titled “Who writes on the target”- An approval is set again by its approver, and a guard lift by the person that it names. The command impersonates them.
- The command writes an object as the person that its
metal.platform-kit.org/requested-bynames. Such an object without the annotation getspk-metal-pivot, and the command writes it as that user. See Admission policies › Requested by.
Audit lines
Section titled “Audit lines”The command writes audit lines to standard error, in the format of the operator. They name you as the user who ran the move:
- An
approvedorguard.liftedline with"replayed":trueandreplayedByfor each approval and guard lift that it sets again. A replayed line is a copy of a decision. The original line is in the logs of the source cluster. - A
deletedline with the reasonPivotPrunedfor each object that it removes from the target cluster.
The operator in the target cluster does not write these lines. Keep the standard error of the command with your audit logs:
pk-metal pivot --to mgmt.kubeconfig 2> >(tee -a pivot-audit.jsonl >&2)Exit status
Section titled “Exit status”An answer other than y or yes gives code 1. Nothing changed.
Related
Section titled “Related”- Pivot model explains why the move is safe.
- Pivot the operator is the procedure.
- Your first cluster in the lab
- pk-metal status shows the machines from the new cluster after the move.