第 6 章 安装程序置备的安装后配置


成功部署安装程序置备的集群后,请考虑以下安装后流程。

6.1. 可选:为断开连接的集群配置 NTP

OpenShift Container Platform 在集群节点上安装 chrony 网络时间协议(NTP)服务。使用以下步骤在 control plane 节点上配置 NTP 服务器,并将 worker 节点配置为成功部署后,将 worker 节点配置为 control plane 节点的 NTP 客户端。

OpenShift Container Platform 节点必须在日期和时间上达成一致才能正确运行。当 worker 节点从 control plane 节点上的 NTP 服务器检索日期和时间时,它会启用未连接到可路由网络的集群的安装和操作,因此无法访问更高的 stratum NTP 服务器。

流程

  1. 使用以下命令在安装主机上安装 Butane:

    $ sudo dnf -y install butane
    Copy to Clipboard Toggle word wrap
  2. 为 control plane 节点创建一个 Butane 配置 99-master-chrony-conf-override.bu,包括 chrony.conf 文件的内容。

    注意

    如需有关 Butane 的信息,请参阅"使用 Butane 创建机器配置"。

    但ane 配置示例

    variant: openshift
    version: 4.14.0
    metadata:
      name: 99-master-chrony-conf-override
      labels:
        machineconfiguration.openshift.io/role: master
    storage:
      files:
        - path: /etc/chrony.conf
          mode: 0644
          overwrite: true
          contents:
            inline: |
              # Use public servers from the pool.ntp.org project.
              # Please consider joining the pool (https://www.pool.ntp.org/join.html).
    
              # The Machine Config Operator manages this file
              server openshift-master-0.<cluster-name>.<domain> iburst 
    1
    
              server openshift-master-1.<cluster-name>.<domain> iburst
              server openshift-master-2.<cluster-name>.<domain> iburst
    
              stratumweight 0
              driftfile /var/lib/chrony/drift
              rtcsync
              makestep 10 3
              bindcmdaddress 127.0.0.1
              bindcmdaddress ::1
              keyfile /etc/chrony.keys
              commandkey 1
              generatecommandkey
              noclientlog
              logchange 0.5
              logdir /var/log/chrony
    
              # Configure the control plane nodes to serve as local NTP servers
              # for all worker nodes, even if they are not in sync with an
              # upstream NTP server.
    
              # Allow NTP client access from the local network.
              allow all
              # Serve time even if not synchronized to a time source.
              local stratum 3 orphan
    Copy to Clipboard Toggle word wrap

    1
    您必须将 <cluster-name> 替换为集群名称,并将 <domain> 替换为完全限定域名。
  3. 使用 Butane 生成 MachineConfig 对象文件 99-master-chrony-conf-override.yaml,其中包含要发送到 control plane 节点的配置:

    $ butane 99-master-chrony-conf-override.bu -o 99-master-chrony-conf-override.yaml
    Copy to Clipboard Toggle word wrap
  4. 为引用 control plane 节点上的 NTP 服务器的 worker 节点创建 Butane 配置 99-worker-chrony-conf-override.bu,包括 chrony.conf 文件的内容。

    但ane 配置示例

    variant: openshift
    version: 4.14.0
    metadata:
      name: 99-worker-chrony-conf-override
      labels:
        machineconfiguration.openshift.io/role: worker
    storage:
      files:
        - path: /etc/chrony.conf
          mode: 0644
          overwrite: true
          contents:
            inline: |
              # The Machine Config Operator manages this file.
              server openshift-master-0.<cluster-name>.<domain> iburst 
    1
    
              server openshift-master-1.<cluster-name>.<domain> iburst
              server openshift-master-2.<cluster-name>.<domain> iburst
    
              stratumweight 0
              driftfile /var/lib/chrony/drift
              rtcsync
              makestep 10 3
              bindcmdaddress 127.0.0.1
              bindcmdaddress ::1
              keyfile /etc/chrony.keys
              commandkey 1
              generatecommandkey
              noclientlog
              logchange 0.5
              logdir /var/log/chrony
    Copy to Clipboard Toggle word wrap

    1
    您必须将 <cluster-name> 替换为集群名称,并将 <domain> 替换为完全限定域名。
  5. 使用 Butane 生成 MachineConfig 对象文件 99-worker-chrony-conf-override.yaml,其中包含要交付至 worker 节点的配置:

    $ butane 99-worker-chrony-conf-override.bu -o 99-worker-chrony-conf-override.yaml
    Copy to Clipboard Toggle word wrap
  6. 99-master-chrony-conf-override.yaml 策略应用到 control plane 节点。

    $ oc apply -f 99-master-chrony-conf-override.yaml
    Copy to Clipboard Toggle word wrap

    输出示例

    machineconfig.machineconfiguration.openshift.io/99-master-chrony-conf-override created
    Copy to Clipboard Toggle word wrap

  7. 99-worker-chrony-conf-override.yaml 策略应用到 worker 节点。

    $ oc apply -f 99-worker-chrony-conf-override.yaml
    Copy to Clipboard Toggle word wrap

    输出示例

    machineconfig.machineconfiguration.openshift.io/99-worker-chrony-conf-override created
    Copy to Clipboard Toggle word wrap

  8. 检查应用的 NTP 设置的状态。

    $ oc describe machineconfigpool
    Copy to Clipboard Toggle word wrap
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat