8.2. 配置 PTP 设备
PTP Operator 将 NodePtpDevice.ptp.openshift.io 自定义资源定义(CRD)添加到 OpenShift Container Platform。
安装后,PTP Operator 会在每个节点中搜索具有 PTP 功能的网络设备。Operator 为提供兼容 PTP 的网络设备的每个节点创建并更新 NodePtpDevice 自定义资源(CR)对象。
带有内置 PTP 功能的网络接口控制器(NIC)硬件有时需要特定于设备的配置。您可以通过在 PtpConfig 自定义资源(CR)中配置插件,将特定于硬件的 NIC 功能用于 PTP Operator 支持的硬件。linuxptp-daemon 服务使用 plugin 小节中的指定参数根据特定的硬件配置启动 linuxptp 进程(ptp4l 和 phc2sys)。
在 OpenShift Container Platform 4.21 中,使用 PtpConfig 插件支持 Intel E810 NIC。
8.2.1. 使用 CLI 安装 PTP Operator 复制链接链接已复制到粘贴板!
作为集群管理员,您可以使用 CLI 安装 Operator。
先决条件
- 在裸机中安装有支持 PTP 硬件的节点的集群。
-
安装 OpenShift CLI(
oc)。 -
以具有
cluster-admin特权的用户身份登录。
流程
为 PTP Operator 创建命名空间。
将以下 YAML 保存到
ptp-namespace.yaml文件中:apiVersion: v1 kind: Namespace metadata: name: openshift-ptp annotations: workload.openshift.io/allowed: management labels: name: openshift-ptp openshift.io/cluster-monitoring: "true"创建
NamespaceCR:$ oc create -f ptp-namespace.yaml
为 PTP Operator 创建 Operator 组。
在
ptp-operatorgroup.yaml文件中保存以下 YAML:apiVersion: operators.coreos.com/v1 kind: OperatorGroup metadata: name: ptp-operators namespace: openshift-ptp spec: targetNamespaces: - openshift-ptp创建
OperatorGroupCR:$ oc create -f ptp-operatorgroup.yaml
订阅 PTP Operator。
将以下 YAML 保存到
ptp-sub.yaml文件中:apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: ptp-operator-subscription namespace: openshift-ptp spec: channel: "stable" name: ptp-operator source: redhat-operators sourceNamespace: openshift-marketplace创建
SubscriptionCR:$ oc create -f ptp-sub.yaml
要验证是否已安装 Operator,请输入以下命令:
$ oc get csv -n openshift-ptp -o custom-columns=Name:.metadata.name,Phase:.status.phase输出示例
Name Phase 4.21.0-202301261535 Succeeded