5.3. 安装后更改 Ignition 配置

机器配置池管理节点集群及其相应的机器配置(Machine Configs)。机器配置包含集群的配置信息。列出所有已知的机器配置池:

$ oc get machineconfigpools

NAME   CONFIG                                  UPDATED UPDATING DEGRADED
master master-1638c1aea398413bb918e76632f20799 False   False    False
worker worker-2feef4f8288936489a5a832ca8efe953 False   False    False

列出所有机器配置:

$ oc get machineconfig

NAME                                      GENERATEDBYCONTROLLER   IGNITIONVERSION   CREATED   OSIMAGEURL

00-master                                 4.0.0-0.150.0.0-dirty   2.2.0             16m
00-master-ssh                             4.0.0-0.150.0.0-dirty                     16m
00-worker                                 4.0.0-0.150.0.0-dirty   2.2.0             16m
00-worker-ssh                             4.0.0-0.150.0.0-dirty                     16m
01-master-kubelet                         4.0.0-0.150.0.0-dirty   2.2.0             16m
01-worker-kubelet                         4.0.0-0.150.0.0-dirty   2.2.0             16m
master-1638c1aea398413bb918e76632f20799   4.0.0-0.150.0.0-dirty   2.2.0             16m
worker-2feef4f8288936489a5a832ca8efe953   4.0.0-0.150.0.0-dirty   2.2.0             16m

在涉及到应用这些机器配置时,Machine Config Operator 的行为与 Ignition 有些不同。MachineConfig 按顺序读取(从 00* 到 99*)。MachineConfig 中的标签标识每个所用于的节点类型(master 节点或 worker 节点)。如果同一文件出现在多个 MachineConfig 文件中,则以最后一个文件为准。例如,出现在 99* 文件中的任何文件都将替换出现在 00* 文件中的同一文件。输入的 MachineConfig 对象将合并为一个“渲染的”MachineConfig 对象,该对象将被 Operator 用作目标,也是您可以在 MachineConfigPool 中看到的值。

要查看正在通过 MachineConfig 管理的文件,请查找特定 MachineConfig 中的“Path:”。例如:

$ oc describe machineconfigs 01-worker-container-runtime | grep Path:
            Path:            /etc/containers/registries.conf
            Path:            /etc/containers/storage.conf
            Path:            /etc/crio/crio.conf

确保为 MachineConfig 提供更新的名称(例如 10-worker-container-runtime)。请记住,每个文件的内容都是 URL 样式的数据。然后,将新 MachineConfig 应用到集群。