第 4 章 为托管的 control plane 处理机器配置
在一个独立的 OpenShift Container Platform 集群中,机器配置池管理一组节点。您可以使用 MachineConfigPool
自定义资源 (CR) 处理机器配置。
提示
您可以在 NodePool
CR 的 nodepool.spec.config
字段中引用任何 machineconfiguration.openshift.io
资源。
在托管的 control plane 中,MachineConfigPool
CR 不存在。节点池包含一组计算节点。您可以使用节点池处理机器配置。
4.1. 为托管的 control plane 配置节点池
在托管的 control plane 上,您可以通过在管理集群中的配置映射中创建 MachineConfig
对象来配置节点池。
流程
要在管理集群中的配置映射中创建
MachineConfig
对象,请输入以下信息:apiVersion: v1 kind: ConfigMap metadata: name: <configmap_name> namespace: clusters data: config: | apiVersion: machineconfiguration.openshift.io/v1 kind: MachineConfig metadata: labels: machineconfiguration.openshift.io/role: worker name: <machineconfig_name> spec: config: ignition: version: 3.2.0 storage: files: - contents: source: data:... mode: 420 overwrite: true path: ${PATH} 1
- 1
- 在存储
MachineConfig
对象的节点上设置路径。
将对象添加到配置映射后,您可以将配置映射应用到节点池,如下所示:
$ oc edit nodepool <nodepool_name> --namespace <hosted_cluster_namespace>
apiVersion: hypershift.openshift.io/v1alpha1 kind: NodePool metadata: # ... name: nodepool-1 namespace: clusters # ... spec: config: - name: <configmap_name> 1 # ...
- 1
- 将
<configmap_name
> 替换为配置映射的名称。