|
| 1 | +// This is included in the following assemblies: |
| 2 | +// |
| 3 | +// ipi-install-post-installation-configuration.adoc |
| 4 | +[id='configuring-ntp-for-disconnected-clusters_{context}'] |
| 5 | + |
| 6 | += Configuring NTP for disconnected clusters |
| 7 | + |
| 8 | +{product-title} installs the `chrony` Network Time Protocol (NTP) service on the cluster nodes. After successfully deploying an installer-provisioned disconnected cluster, configure NTP servers on the control plane nodes, and configure worker nodes as NTP clients of the control plane nodes. |
| 9 | + |
| 10 | +image::152_OpenShift_Config_NTP_0421.svg[Configuring NTP for disconnected clusters] |
| 11 | + |
| 12 | +{product-title} nodes must agree on a date and time to run properly. When worker nodes retrieve the date and time from the NTP servers on the control plane nodes, it enables the installation and operation of clusters that are not connected to a routable network and thereby do not have access to a higher stratum NTP server. |
| 13 | + |
| 14 | +.Procedure |
| 15 | + |
| 16 | +. Create a `~/control-plane-chrony.conf` configuration file for the control plane nodes. |
| 17 | ++ |
| 18 | +[source,bash] |
| 19 | +.Configuration file example |
| 20 | +---- |
| 21 | +# Use public servers from the pool.ntp.org project. |
| 22 | +# Please consider joining the pool (https://www.pool.ntp.org/join.html). |
| 23 | +
|
| 24 | +# This file is managed by the machine config operator |
| 25 | +server openshift-master-0.<cluster-name>.<domain> iburst <1> |
| 26 | +server openshift-master-1.<cluster-name>.<domain> iburst |
| 27 | +server openshift-master-2.<cluster-name>.<domain> iburst |
| 28 | +
|
| 29 | +stratumweight 0 |
| 30 | +driftfile /var/lib/chrony/drift |
| 31 | +rtcsync |
| 32 | +makestep 10 3 |
| 33 | +bindcmdaddress 127.0.0.1 |
| 34 | +bindcmdaddress ::1 |
| 35 | +keyfile /etc/chrony.keys |
| 36 | +commandkey 1 |
| 37 | +generatecommandkey |
| 38 | +noclientlog |
| 39 | +logchange 0.5 |
| 40 | +logdir /var/log/chrony |
| 41 | +
|
| 42 | +# Configure the control plane nodes to serve as local NTP servers |
| 43 | +# for all worker nodes, even if they are not in sync with an |
| 44 | +# upstream NTP server. |
| 45 | +
|
| 46 | +# Allow NTP client access from the local network. |
| 47 | +allow all |
| 48 | +# Serve time even if not synchronized to a time source. |
| 49 | +local stratum 3 orphan |
| 50 | +---- |
| 51 | ++ |
| 52 | +Where: |
| 53 | ++ |
| 54 | +<1> You must replace `<cluster-name>` with the name of the cluster and replace `<domain>` with the fully qualified domain name. |
| 55 | + |
| 56 | +. Create a `~/worker-chrony.conf` configuration file for the worker nodes such that worker nodes reference the NTP servers on the control plane nodes. |
| 57 | ++ |
| 58 | +[source,bash] |
| 59 | +.Configuration file example |
| 60 | +---- |
| 61 | +# This file is managed by the machine config operator |
| 62 | +server openshift-master-0.<cluster-name>.<domain> iburst <1> |
| 63 | +server openshift-master-1.<cluster-name>.<domain> iburst |
| 64 | +server openshift-master-2.<cluster-name>.<domain> iburst |
| 65 | +
|
| 66 | +stratumweight 0 |
| 67 | +driftfile /var/lib/chrony/drift |
| 68 | +rtcsync |
| 69 | +makestep 10 3 |
| 70 | +bindcmdaddress 127.0.0.1 |
| 71 | +bindcmdaddress ::1 |
| 72 | +keyfile /etc/chrony.keys |
| 73 | +commandkey 1 |
| 74 | +generatecommandkey |
| 75 | +noclientlog |
| 76 | +logchange 0.5 |
| 77 | +logdir /var/log/chrony |
| 78 | +---- |
| 79 | ++ |
| 80 | +Where: |
| 81 | ++ |
| 82 | +<1> You must replace `<cluster-name>` with the name of the cluster and replace `<domain>` with the fully qualified domain name. |
| 83 | + |
| 84 | +. Create a `~/ntp-server.yaml` configuration file for telling the Machine Configuration Operator to apply the `~/control-plane-chrony.conf` settings to the NTP servers on the control plane nodes. |
| 85 | ++ |
| 86 | +[source,bash] |
| 87 | +.Configuration file example |
| 88 | +---- |
| 89 | +# This example MachineConfig replaces ~/control-plane-chrony.conf |
| 90 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 91 | +kind: MachineConfig |
| 92 | +metadata: |
| 93 | + labels: |
| 94 | + machineconfiguration.openshift.io/role: master |
| 95 | + name: 99-master-etc-chrony-conf-override-to-server |
| 96 | +spec: |
| 97 | + config: |
| 98 | + ignition: |
| 99 | + version: 2.2.0 |
| 100 | + storage: |
| 101 | + files: |
| 102 | + - contents: |
| 103 | + source: data:text/plain;charset=utf-8;base64,BASE64ENCODEDCONFIGFILE<1> |
| 104 | + filesystem: root |
| 105 | + mode: 0644 |
| 106 | + path: /etc/control-plane-chrony.conf |
| 107 | +---- |
| 108 | ++ |
| 109 | +Where: |
| 110 | ++ |
| 111 | +<1> You must replace the `BASE64ENCODEDCONFIGFILE` string with the base64-encoded string of the `~/control-plane-chrony.conf` file in the subsequent step. |
| 112 | + |
| 113 | +. Generate a base64 string of the `~/control-plane-chrony.conf` file. |
| 114 | ++ |
| 115 | +[source,bash] |
| 116 | +---- |
| 117 | +$ base64 ~/control-plane-chrony.conf |
| 118 | +---- |
| 119 | ++ |
| 120 | +[source,bash] |
| 121 | +.Example output |
| 122 | +---- |
| 123 | +IyBVc2UgcHVibGljIHNlcnZlcnMgZnJvbSB0aGUgcG9vbC5udHAub3JnIHByb2plY3QuCiMgUGxl |
| 124 | +YXNlIGNvbnNpZGVyIGpvaW5pbmcgdGhlIHBvb2wgKGh0dHBzOi8vd3d3LnBvb2wubnRwLm9yZy9q |
| 125 | +b2luLmh0bWwpLgoKIyBUaGlzIGZpbGUgaXMgbWFuYWdlZCBieSB0aGUgbWFjaGluZSBjb25maWcg |
| 126 | +b3BlcmF0b3IKc2VydmVyIG9wZW5zaGlmdC1tYXN0ZXItMC48Y2x1c3Rlci1uYW1lPi48ZG9tYWlu |
| 127 | +PiBpYnVyc3QKc2VydmVyIG9wZW5zaGlmdC1tYXN0ZXItMS48Y2x1c3Rlci1uYW1lPi48ZG9tYWlu |
| 128 | +PiBpYnVyc3QKc2VydmVyIG9wZW5zaGlmdC1tYXN0ZXItMi48Y2x1c3Rlci1uYW1lPi48ZG9tYWlu |
| 129 | +PiBpYnVyc3QKCnN0cmF0dW13ZWlnaHQgMApkcmlmdGZpbGUgL3Zhci9saWIvY2hyb255L2RyaWZ0 |
| 130 | +CnJ0Y3N5bmMKbWFrZXN0ZXAgMTAgMwpiaW5kY21kYWRkcmVzcyAxMjcuMC4wLjEKYmluZGNtZGFk |
| 131 | +ZHJlc3MgOjoxCmtleWZpbGUgL2V0Yy9jaHJvbnkua2V5cwpjb21tYW5ka2V5IDEKZ2VuZXJhdGVj |
| 132 | +b21tYW5ka2V5Cm5vY2xpZW50bG9nCmxvZ2NoYW5nZSAwLjUKbG9nZGlyIC92YXIvbG9nL2Nocm9u |
| 133 | +eQoKIyBDb25maWd1cmUgdGhlIGNvbnRyb2wgcGxhbmUgbm9kZXMgdG8gc2VydmUgYXMgbG9jYWwg |
| 134 | +TlRQIHNlcnZlcnMKIyBmb3IgYWxsIHdvcmtlciBub2RlcywgZXZlbiBpZiB0aGV5IGFyZSBub3Qg |
| 135 | +aW4gc3luYyB3aXRoIGFuCiMgdXBzdHJlYW0gTlRQIHNlcnZlci4KCiMgQWxsb3cgTlRQIGNsaWVu |
| 136 | +dCBhY2Nlc3MgZnJvbSB0aGUgbG9jYWwgbmV0d29yay4KYWxsb3cgYWxsCiMgU2VydmUgdGltZSBl |
| 137 | +dmVuIGlmIG5vdCBzeW5jaHJvbml6ZWQgdG8gYSB0aW1lIHNvdXJjZS4KbG9jYWwgc3RyYXR1bSAz |
| 138 | +IG9ycGhhbgo= |
| 139 | +---- |
| 140 | ++ |
| 141 | +Replace the `BASE64ENCODEDCONFIGFILE` string in the `~/ntp-server.yaml` with the base64-encoded string. |
| 142 | + |
| 143 | +. Apply the `ntp-server.yaml` policy to the control plane nodes. |
| 144 | ++ |
| 145 | +[source,bash] |
| 146 | +---- |
| 147 | +$ oc apply -f ~/ntp-server.yaml |
| 148 | +---- |
| 149 | ++ |
| 150 | +[source,bash] |
| 151 | +.Example output |
| 152 | +---- |
| 153 | +machineconfig.machineconfiguration.openshift.io/99-master-etc-chrony-conf-override-for-server created |
| 154 | +---- |
| 155 | + |
| 156 | +. Create a `~/ntp-client.yaml` configuration file for telling the Machine Configuration Operator to apply the `~/worker-chrony.conf` settings to the NTP clients on the worker nodes. |
| 157 | ++ |
| 158 | +[source,bash] |
| 159 | +.Configuration file example |
| 160 | +---- |
| 161 | +# This example MachineConfig replaces ~/worker-chrony.conf |
| 162 | +apiVersion: machineconfiguration.openshift.io/v1 |
| 163 | +kind: MachineConfig |
| 164 | +metadata: |
| 165 | + labels: |
| 166 | + machineconfiguration.openshift.io/role: worker |
| 167 | + name: 99-master-etc-chrony-conf-override-for-worker |
| 168 | +spec: |
| 169 | + config: |
| 170 | + ignition: |
| 171 | + version: 2.2.0 |
| 172 | + storage: |
| 173 | + files: |
| 174 | + - contents: |
| 175 | + source: data:text/plain;charset=utf-8;base64,BASE64ENCODEDCONFIGFILE<1> |
| 176 | + filesystem: root |
| 177 | + mode: 0644 |
| 178 | + path: /etc/worker-chrony.conf |
| 179 | +---- |
| 180 | ++ |
| 181 | +Where: |
| 182 | ++ |
| 183 | +<1> You must replace the `BASE64ENCODEDCONFIGFILE` string with the base64-encoded string of the `~/worker-chrony.conf` file in the subsequent step. |
| 184 | + |
| 185 | + |
| 186 | +. Generate a base64-encoded string of the `~/worker-chrony.conf` file. |
| 187 | ++ |
| 188 | +[source,bash] |
| 189 | +---- |
| 190 | +$ base64 ~/worker-chrony.conf |
| 191 | +---- |
| 192 | ++ |
| 193 | +[source,bash] |
| 194 | +.Example output |
| 195 | +---- |
| 196 | +IyBUaGlzIGZpbGUgaXMgbWFuYWdlZCBieSB0aGUgbWFjaGluZSBjb25maWcgb3BlcmF0b3IKc2Vy |
| 197 | +dmVyIG9wZW5zaGlmdC1tYXN0ZXItMC48Y2x1c3Rlci1uYW1lPi48ZG9tYWluPiBpYnVyc3QKc2Vy |
| 198 | +dmVyIG9wZW5zaGlmdC1tYXN0ZXItMS48Y2x1c3Rlci1uYW1lPi48ZG9tYWluPiBpYnVyc3QKc2Vy |
| 199 | +dmVyIG9wZW5zaGlmdC1tYXN0ZXItMi48Y2x1c3Rlci1uYW1lPi48ZG9tYWluPiBpYnVyc3QKCnN0 |
| 200 | +cmF0dW13ZWlnaHQgMApkcmlmdGZpbGUgL3Zhci9saWIvY2hyb255L2RyaWZ0CnJ0Y3N5bmMKbWFr |
| 201 | +ZXN0ZXAgMTAgMwpiaW5kY21kYWRkcmVzcyAxMjcuMC4wLjEKYmluZGNtZGFkZHJlc3MgOjoxCmtl |
| 202 | +eWZpbGUgL2V0Yy9jaHJvbnkua2V5cwpjb21tYW5ka2V5IDEKZ2VuZXJhdGVjb21tYW5ka2V5Cm5v |
| 203 | +Y2xpZW50bG9nCmxvZ2NoYW5nZSAwLjUKbG9nZGlyIC92YXIvbG9nL2Nocm9ueQo= |
| 204 | +---- |
| 205 | ++ |
| 206 | +Replace the `BASE64ENCODEDCONFIGFILE` string in the `~/ntp-client.yaml` file with the base64-encoded string. |
| 207 | + |
| 208 | + |
| 209 | +. Apply the `~/ntp-client.yaml` policy to the worker nodes. |
| 210 | ++ |
| 211 | +[source,bash] |
| 212 | +---- |
| 213 | +$ oc apply -f ~/worker-chrony.conf |
| 214 | +---- |
| 215 | ++ |
| 216 | +[source,bash] |
| 217 | +.Example output |
| 218 | +---- |
| 219 | +machineconfig.machineconfiguration.openshift.io/99-master-etc-chrony-conf-override-for-worker created |
| 220 | +---- |
| 221 | + |
| 222 | +. Check the status of the applied NTP settings. |
| 223 | ++ |
| 224 | +[source,bash] |
| 225 | +---- |
| 226 | +$ oc describe machineconfigpool |
| 227 | +---- |
0 commit comments