11.7. linuxptp サービスを境界クロックとして設定
PTP Operator は PtpConfig.ptp.openshift.io カスタムリソース定義 (CRD) を OpenShift Container Platform に追加します。PtpConfig カスタムリソース (CR) オブジェクトを作成して、linuxptp サービス (ptp4l、phc2sys) を設定できます。
前提条件
-
OpenShift CLI (
oc) がインストールされている。 -
cluster-admin権限を持つユーザーとしてログインしている。 - PTP Operator をインストールします。
手順
以下の
PtpConfigCR を作成してから、YAML をboundary-clock-ptp-config.yamlファイルに保存します。apiVersion: ptp.openshift.io/v1 kind: PtpConfig metadata: name: boundary-clock-ptp-config1 namespace: openshift-ptp spec: profile:2 - name: "profile1"3 interface: ""4 ptp4lOpts: "-2"5 ptp4lConf: |6 [ens1f0]7 masterOnly 0 [ens1f3]8 masterOnly 1 [global] # # Default Data Set # twoStepFlag 1 #slaveOnly 1 priority1 128 priority2 128 domainNumber 24 #utc_offset 37 clockClass 248 clockAccuracy 0xFE offsetScaledLogVariance 0xFFFF free_running 0 freq_est_interval 1 dscp_event 0 dscp_general 0 dataset_comparison G.8275.x G.8275.defaultDS.localPriority 128 # # Port Data Set # logAnnounceInterval -3 logSyncInterval -4 logMinDelayReqInterval -4 logMinPdelayReqInterval -4 announceReceiptTimeout 3 syncReceiptTimeout 0 delayAsymmetry 0 fault_reset_interval 4 neighborPropDelayThresh 20000000 masterOnly 0 G.8275.portDS.localPriority 128 # # Run time options # assume_two_step 0 logging_level 6 path_trace_enabled 0 follow_up_info 0 hybrid_e2e 0 inhibit_multicast_service 0 net_sync_monitor 0 tc_spanning_tree 0 tx_timestamp_timeout 10 #was 1 (default !) unicast_listen 0 unicast_master_table 0 unicast_req_duration 3600 use_syslog 1 verbose 0 summary_interval -4 kernel_leap 1 check_fup_sync 0 # # Servo Options # pi_proportional_const 0.0 pi_integral_const 0.0 pi_proportional_scale 0.0 pi_proportional_exponent -0.3 pi_proportional_norm_max 0.7 pi_integral_scale 0.0 pi_integral_exponent 0.4 pi_integral_norm_max 0.3 step_threshold 2.0 first_step_threshold 0.00002 max_frequency 900000000 clock_servo pi sanity_freq_limit 200000000 ntpshm_segment 0 # # Transport options # transportSpecific 0x0 ptp_dst_mac 01:1B:19:00:00:00 p2p_dst_mac 01:80:C2:00:00:0E udp_ttl 1 udp6_scope 0x0E uds_address /var/run/ptp4l # # Default interface options # clock_type BC network_transport UDPv4 delay_mechanism E2E time_stamping hardware tsproc_mode filter delay_filter moving_median delay_filter_length 10 egressLatency 0 ingressLatency 0 boundary_clock_jbod 09 # # Clock description # productDescription ;; revisionData ;; manufacturerIdentity 00:00:00 userDescription ; timeSource 0xA0 phc2sysOpts: "-a -r"10 ptpSchedulingPolicy: SCHED_OTHER11 ptpSchedulingPriority: 1012 recommend:13 - profile: "profile1"14 priority: 1015 match:16 - nodeLabel: "node-role.kubernetes.io/worker"17 nodeName: "compute-0.example.com"18 - 1
PtpConfigCR の名前。- 2
- 1 つ以上の
profileオブジェクトの配列を指定します。 - 3
- プロファイルオブジェクトを一意に識別するプロファイルオブジェクトの名前を指定します。
- 4
- このフィールドは、境界クロックの場合は空のままにする必要があります。
- 5
ptp4lサービスのシステム設定オプション (例:-2) を指定します。ネットワークインターフェイス名とサービス設定ファイルが自動的に追加されるため、オプションには、ネットワークインターフェイス名-i <interface>およびサービス設定ファイル-f /etc/ptp4l.confを含めないでください。- 6
ptp4lを境界クロックとして起動するために必要な設定を指定します。たとえば、ens1f0はグランドマスタークロックから同期し、ens1f3は接続されたデバイスを同期します。- 7
- 同期元のインターフェイス名。
- 8
- インターフェイスに接続されたデバイスを同期するインターフェイス。
- 9
- Intel Columbiaville 800 Series NIC の場合、
boundary_clock_jbodが0に設定されていることを確認します。Intel Fortville X710 シリーズ NIC の場合、boundary_clock_jbodが1に設定されていることを確認します。 - 10
phc2sysサービスのシステム設定オプション (例:-a -r) を指定します。このフィールドが空の場合、PTP Operator はphc2sysサービスを開始しません。- 11
- ptp4l と phc2sys プロセスのスケジューリングポリシー。デフォルト値は
SCHED_OTHERです。FIFO スケジューリングをサポートするシステムでは、SCHED_FIFOを使用してください。 - 12
ptp SchedulingPolicyがSCHED_FIFOに設定されている場合に、ptp4lおよびphc2sysプロセスの FIFO の優先度を設定するために使用される 1-65 の整数値。ptpSchedulingPriorityフィールドは、ptpSchedulingPolicyがSCHED_OTHERに設定されている場合は使用されません。- 13
profileがノードに適用される方法を定義する 1 つ以上のrecommendオブジェクトの配列を指定します。- 14
profileセクションに定義されるprofileオブジェクト名を指定します。- 15
0から99までの整数値でpriorityを指定します。数値が大きいほど優先度が低くなるため、99の優先度は10よりも低くなります。ノードがmatchフィールドで定義されるルールに基づいて複数のプロファイルに一致する場合、優先順位の高いプロファイルがそのノードに適用されます。- 16
matchルールを、nodeLabelまたはnodeNameで指定します。- 17
oc get nodes --show-labelsコマンドを使用して、ノードオブジェクトのnode.LabelsのkeyでnodeLabelを指定します。- 18
oc get nodesコマンドを使用して、ノードオブジェクトのnode.NameでnodeNameを指定します。
以下のコマンドを実行して CR を作成します。
$ oc create -f boundary-clock-ptp-config.yaml
検証手順
PtpConfigプロファイルがノードに適用されていることを確認します。以下のコマンドを実行して、
openshift-ptpnamespace の Pod の一覧を取得します。$ oc get pods -n openshift-ptp -o wide出力例
NAME READY STATUS RESTARTS AGE IP NODE linuxptp-daemon-4xkbb 1/1 Running 0 43m 10.1.196.24 compute-0.example.com linuxptp-daemon-tdspf 1/1 Running 0 43m 10.1.196.25 compute-1.example.com ptp-operator-657bbb64c8-2f8sj 1/1 Running 0 43m 10.129.0.61 control-plane-1.example.comプロファイルが正しいことを確認します。
PtpConfigプロファイルで指定したノードに対応するlinuxptpデーモンのログを検査します。以下のコマンドを実行します。$ oc logs linuxptp-daemon-4xkbb -n openshift-ptp -c linuxptp-daemon-container出力例
I1115 09:41:17.117596 4143292 daemon.go:107] in applyNodePTPProfile I1115 09:41:17.117604 4143292 daemon.go:109] updating NodePTPProfile to: I1115 09:41:17.117607 4143292 daemon.go:110] ------------------------------------ I1115 09:41:17.117612 4143292 daemon.go:102] Profile Name: profile1 I1115 09:41:17.117616 4143292 daemon.go:102] Interface: I1115 09:41:17.117620 4143292 daemon.go:102] Ptp4lOpts: -2 I1115 09:41:17.117623 4143292 daemon.go:102] Phc2sysOpts: -a -r I1115 09:41:17.117626 4143292 daemon.go:116] ------------------------------------