How to edit and patch Talos machine configuration, with reboot, immediately, or stage update on reboot.
talosctl
commands which facilitate machine configuration updates:
talosctl apply-config
to apply configuration from the filetalosctl edit machineconfig
to launch an editor with existing node configuration, make changes and apply configuration backtalosctl patch machineconfig
to apply automated machine configuration via JSON patch--mode=reboot
): update configuration, reboot Talos node to apply configuration change--mode=no-reboot
flag): change is applied immediately without a reboot, fails if the change contains any fields that can not be updated without a reboot--mode=staged
): change is staged to be applied after a reboot, but node is not rebooted--mode=try
): change is applied immediately (if not possible, returns an error), and reverts it automatically in 1 minute if no configuration update is applied--mode=interactive
; only for talosctl apply-config
): launches TUI based interactive installerNote: applying change on next reboot (Additionally, there is also--mode=staged
) doesn’t modify current node configuration, so next call totalosctl edit machineconfig --mode=staged
will not see changes
talosctl get machineconfig v1alpha1 -o jsonpath='{.spec}'
, which retrieves the current node configuration API resource and return just the machine configuration in the .spec
field.
It can be used to modify the configuration locally before being applied to the node.
The list of config changes allowed to be applied immediately in Talos:
.debug
.cluster
.machine.time
.machine.ca
.machine.acceptedCAs
.machine.certCANs
.machine.install
(configuration is only applied during install/upgrade).machine.network
.machine.nodeAnnotations
.machine.nodeLabels
.machine.nodeTaints
.machine.sysfs
.machine.sysctls
.machine.logging
.machine.controlplane
.machine.kubelet
.machine.pods
.machine.kernel
.machine.registries
(CRI containerd plugin will not pick up the registry authentication settings without a reboot).machine.features.kubernetesTalosAPIAccess
.machine.features.hostDNS
.machine.features.imageCache
.machine.features.kubePrism
.machine.features.nodeAddressSortAlgorithm
talosctl apply-config
talosctl gen config
to the node.
It can also be used to apply configuration to running nodes.
The initial YAML for this is typically obtained using talosctl get machineconfig v1alpha1 -o jsonpath='{.spec}' > machineconfig.yaml
.
Example:
apply-config
can also be invoked as apply machineconfig
:
Note: when a Talos node is running in the maintenance mode it’s necessary to provide --insecure (-i)
flag to connect to the API and apply the config.
talosctl edit machineconfig
talosctl edit
loads current machine configuration from the node and launches configured editor to modify the config.
If config hasn’t been changed in the editor (or if updated config is empty), update is not applied.
Note: Talos uses environment variablesExample:TALOS_EDITOR
,EDITOR
to pick up the editor preference. If environment variables are missing,vi
editor is used by default.
talosctl patch machineconfig
talosctl patch
works similar to talosctl edit
command - it loads current machine configuration, but instead of launching configured editor it applies a set of JSON patches to the configuration and writes the result back to the node.
Example, updating kubelet version (in auto mode):
Updating kube-apiserver version in immediate mode (without a reboot):
A patch might be applied to multiple nodes when multiple IPs are specified:
@file
syntax: