talosctl gen config but not all of them.
Configuration patching allows modifying machine configuration to fit it for the cluster or a specific machine.
Configuration patching can also be used to mutate existing machine configuration on running Talos nodes.
See reproducible machine configuration for more information on managing your patches.
Patch machine configuration using strategic merge patches
Talos Linux supports patching machine configuration using strategic merge patches. Strategic merge patches look like incomplete machine configuration files:--- separator).
When applied to the machine configuration, the patch gets merged with the respective section of the machine configuration.
In general, machine configuration contents are merged with the contents of the strategic merge patch, with strategic merge patch
values overriding machine configuration values.
There are some special rules:
-
If the field value is a list, the patch value is appended to the list, with the following exceptions:
- values of the fields
cluster.network.podSubnetsandcluster.network.serviceSubnetsare overwritten on merge network.interfacessection is merged with the value in the machine config if there is a match oninterface:ordeviceSelector:keysnetwork.interfaces.vlanssection is merged with the value in the machine config if there is a match on thevlanId:keycluster.apiServer.auditPolicyvalue is replaced on mergeExtensionServiceConfig.configFilessection is merged matching onmountPath(replacingcontentif matches)
- values of the fields
-
When patching a multi-document machine configuration, following rules apply:
- for each document in the patch, the document is merged with the respective document in the machine configuration (matching by
kind,apiVersionandnamefor named documents) - if the patch document doesn’t exist in the machine configuration, it is appended to the machine configuration
- for each document in the patch, the document is merged with the respective document in the machine configuration (matching by
$patch: delete syntax similar to the
Kubernetes
strategic merge patch.
For example, with configuration:
v1alpha1 configuration!) using this syntax:
SideroLinkConfig and ExtensionServiceConfig with name foo from the configuration.
Examples
The following examples demonstrate common use cases for configuration patches.Machine network
Base machine configuration:192.168.10.50 to the eth0 interface and add another interface eth1 with DHCP enabled.
Cluster network
Base machine configuration:Kubelet
Base machine configuration:kubelet node IP to come from the subnet 192.168.10.0/24:
Admission control: Pod security policy
Base machine configuration:rook-ceph.
Patch:
Configuration patching with talosctl CLI
Several talosctl commands accept config patches as command-line flags.
Config patches might be passed either as an inline value or as a reference to a file with @file.patch or file.patch syntax:
talosctl gen config:
talosctl machineconfig patch
talosctl patch:
Multi-document patching
In addition to patching single-document machine configurations, Talos supports patching multi-document machine configuration.
Multi-document patching allows configuration to be modified at the document level. This makes it possible to manage and reuse small, focused configuration fragments instead of editing a single, monolithic machine configuration.
This approach is commonly used to apply targeted changes, such as updating hostnames, network settings, or kubelet configuration, without regenerating the full machine configuration.
For example, the following patch updates a machine’s hostname:
Apply a multi-document patch
Multi-document patches are applied while the machine is in maintenance mode. In this state, the machine has not yet received any credentials or certificates to authenticate the client. To bootstrap authentication, the initial machine configuration must be applied using the the--insecure flag, along with the multi-document patch.
-
<machine-configuration>- is the base machine configuration (for example,controlplane.yamlorworker.yaml) generated usingtalosctl gen config. This configuration contains the credentials required to authenticate the client. -
<node-ip>- is the IP address of the target node. -
<multi-document>- is the YAML file containing the multi-document patch.