외부 NTP 릴레이 구성

이 페이지에서는 Google Distributed Cloud (GDC) 오프라인 어플라이언스의 외부 NTP 리플레이를 구성하는 방법을 설명합니다.

이 단계는 연결이 끊긴 후 어플라이언스를 외부 시간과 동기화하려는 경우에만 필요합니다.

시작하기 전에

어플라이언스를 외부 NTP와 동기화하려면 다음 단계를 완료하세요.

  1. 시작하기 전에 NTP 릴레이가 하나만 있는지 확인하세요. 확인하려면 부트스트래퍼 머신에서 다음 명령어를 실행하세요.

    kubectl get ntprelay -A
    

    출력은 다음 예시와 같이 표시됩니다.

    NAMESPACE    NAME           AGE
    gpc-system   bi-ntp-relay   4d21h
    

NTP 릴레이 구성

  1. 부트스트래퍼를 어플라이언스 기기에 연결하고 연결된 인터페이스의 IP 주소를 확인합니다.

    ifconfig
    mgmt: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 198.18.0.30   netmask 255.255.255.224  broadcast 198.18.0.31
        inet6 fe80::20c:29ff:fea8:fc35  prefixlen 64  scopeid 0x20&lt;link&gt;
    ...
    
  2. 부트스트래퍼 관리 IP를 업스트림 IP로 포함하여 ntprelay CR을 수정합니다.

    kubectl edit ntprelay bi-ntp-relay -n gpc-system
    ntprelay.system.private.gdc.goog/bi-ntp-relay edited
    kubectl get ntprelay bi-ntp-relay -n gpc-system -oyaml
    

    출력은 다음과 같이 표시됩니다. 이 예시에서는 upstreamServers의 IP 주소가 변경됩니다.

    apiVersion: system.private.gdc.goog/v1alpha1
    kind: NTPRelay
    metadata:
      creationTimestamp: "2025-05-16T08:44:21Z"
      generation: 2
      name: bi-ntp-relay
      namespace: gpc-system
      resourceVersion: "10871409"
      uid: 6cde8e65-791c-4bc6-9a8b-d5c9bf103f8b
    spec:
      upstreamServers:
      - 192.0.2.030
    
  3. NTP 동기화를 확인합니다.

    kubectl get pods -l app.kubernetes.io/name=ntp -n ntp-system -o name | xargs -I {} kubectl exec {} -n ntp-system -- chronyc sources -v; echo
    

    출력은 다음과 같이 표시됩니다.

      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
    / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | /             'x' = may be in error, '~' = too variable, '?' = unusable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 192.0.2.026                   1   6    17    43   +286ns[  +36us] +/- 1160us
    =? 192.0.2.029                 0   6     0     -     +0ns[   +0ns] +/-    0ns
    =? 192.0.2.051                 0   6     0     -     +0ns[   +0ns] +/-    0ns
    =? 192.0.2.059            0   6     0     -     +0ns[   +0ns] +/-    0ns
    
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
    / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | /             'x' = may be in error, '~' = too variable, '?' = unusable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 192.0.2.026                 1   6    37     2     +2ns[  +90us] +/-   84us
    =? 192.0.2.029                 2   6     1     8   +368us[ +449us] +/- 3761us
    =? 192.0.2.051                 0   6     1     -     +0ns[   +0ns] +/-    0ns
    =? 192.0.2.059                 2   6     1     8   +663us[ +744us] +/-   11ms
    
      .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
    / .- Source state '*' = current best, '+' = combined, '-' = not combined,
    | /             'x' = may be in error, '~' = too variable, '?' = unusable.
    ||                                                 .- xxxx [ yyyy ] +/- zzzz
    ||      Reachability register (octal) -.           |  xxxx = adjusted offset,
    ||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
    ||                                \     |          |  zzzz = estimated error.
    ||                                 |    |           \
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 192.0.2.026                   1   6    37    29     -6ns[ -759us] +/-   92us
    =? 192.0.2.029                   2   6     1    36   +334us[ -346us] +/- 3775us
    =? 192.0.2.051                   2   6     1    35   -125us[ -813us] +/- 5839us
    =? 192.0.2.059                   0   6     1     -     +0ns[   +0ns] +/-    0ns
    
  4. NTP 포드의 chronyc이 새로 추가된 IP를 참조하는지 확인합니다.

    kubectl exec -it -n ntp-system ntp2-84ddf7cd99-96vqn -- sh
    

    출력은 다음 예시와 같이 표시됩니다.

    Defaulted container "ntp-image" out of: ntp-image, ntp-node-exporter
    # chronyc tracking
    Reference ID    : C612001E (198.18.0.30)
    Stratum         : 2
    Ref time (UTC)  : Wed May 21 07:28:38 2025
    System time     : 0.000000005 seconds slow of NTP time
    Last offset     : +0.000025645 seconds
    RMS offset      : 0.000082131 seconds
    Frequency       : 15.671 ppm slow
    Residual freq   : +0.024 ppm
    Skew            : 0.628 ppm
    Root delay      : 0.000164273 seconds
    Root dispersion : 0.000180630 seconds
    Update interval : 64.8 seconds
    Leap status     : Normal
    # exit