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 Patch Formats
Talos supports two configuration patch formats:- strategic merge patches
- RFC6902 (JSON patches)
Note: Talos 1.5+ supports multi-document machine configuration. JSON patches don’t support multi-document machine configuration, while strategic merge patches do.
Strategic Merge patches
Strategic merge patches look like incomplete machine configuration files:- 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.podSubnets
andcluster.network.serviceSubnets
are overwritten on merge network.interfaces
section is merged with the value in the machine config if there is a match oninterface:
ordeviceSelector:
keysnetwork.interfaces.vlans
section is merged with the value in the machine config if there is a match on thevlanId:
keycluster.apiServer.auditPolicy
value is replaced on mergeExtensionServiceConfig.configFiles
section is merged matching onmountPath
(replacingcontent
if matches)
- values of the fields
- for each document in the patch, the document is merged with the respective document in the machine configuration (matching by
kind
,apiVersion
andname
for named documents) - if the patch document doesn’t exist in the machine configuration, it is appended to the machine configuration
$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.
RFC6902 (JSON Patches)
JSON patches can be written either in JSON or YAML format. A proper JSON patch requires anop
field that depends on the machine configuration contents: whether the path already exists or not.
For example, the strategic merge patch from the previous section can be written either as:
op
depends on whether the /machine/network/hostname
section exists already in the machine config or not.
Examples
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:cluster:
network:
podSubnets:
- 192.168.0.0/16 serviceSubnets:
- 192.0.0.0/12 cni: name: none
Kubelet
Base machine configuration:kubelet
node IP to come from the subnet 192.168.10.0/24
.
machine:
kubelet:
nodeIP:
validSubnets:
- 192.168.10.0/24
Admission Control: Pod Security Policy
Base machine configuration:rook-ceph
.
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
syntax:
talosctl gen config
:
talosctl machineconfig patch
talosctl patch
: