2.2. Configuring the public subnet
All of the OpenShift Container Platform cluster nodes must be on the public subnet. IBM Cloud® Bare Metal (Classic) does not provide a DHCP server on the subnet. Set it up separately on the provisioner node.
You must reset the BASH variables defined when preparing the provisioner node. Rebooting the provisioner node after preparing it will delete the BASH variables previously set.
Procedure
Install
dnsmasq:$ sudo dnf install dnsmasqOpen the
dnsmasqconfiguration file:$ sudo vi /etc/dnsmasq.confAdd the following configuration to the
dnsmasqconfiguration file:interface=baremetal except-interface=lo bind-dynamic log-dhcp dhcp-range=<ip_addr>,<ip_addr>,<pub_cidr>1 dhcp-option=baremetal,121,0.0.0.0/0,<pub_gateway>,<prvn_priv_ip>,<prvn_pub_ip>2 dhcp-hostsfile=/var/lib/dnsmasq/dnsmasq.hostsfile- 1
- Set the DHCP range. Replace both instances of
<ip_addr>with one unused IP address from the public subnet so that thedhcp-rangefor thebaremetalnetwork begins and ends with the same the IP address. Replace<pub_cidr>with the CIDR of the public subnet. - 2
- Set the DHCP option. Replace
<pub_gateway>with the IP address of the gateway for thebaremetalnetwork. Replace<prvn_priv_ip>with the IP address of the provisioner node’s private IP address on theprovisioningnetwork. Replace<prvn_pub_ip>with the IP address of the provisioner node’s public IP address on thebaremetalnetwork.To retrieve the value for
<pub_cidr>, execute:$ ibmcloud sl subnet detail <publicsubnetid> --output JSON | jq .cidrReplace
<publicsubnetid>with the ID of the public subnet.To retrieve the value for
<pub_gateway>, execute:$ ibmcloud sl subnet detail <publicsubnetid> --output JSON | jq .gateway -rReplace
<publicsubnetid>with the ID of the public subnet.To retrieve the value for
<prvn_priv_ip>, execute:$ ibmcloud sl hardware detail <id> --output JSON | \ jq .primaryBackendIpAddress -rReplace
<id>with the ID of the provisioner node.To retrieve the value for
<prvn_pub_ip>, execute:$ ibmcloud sl hardware detail <id> --output JSON | jq .primaryIpAddress -rReplace
<id>with the ID of the provisioner node.
Obtain the list of hardware for the cluster:
$ ibmcloud sl hardware listObtain the MAC addresses and IP addresses for each node:
$ ibmcloud sl hardware detail <id> --output JSON | \ jq '.networkComponents[] | \ "\(.primaryIpAddress) \(.macAddress)"' | grep -v nullReplace
<id>with the ID of the node.Example output
"10.196.130.144 00:e0:ed:6a:ca:b4" "141.125.65.215 00:e0:ed:6a:ca:b5"Make a note of the MAC address and IP address of the public network. Make a separate note of the MAC address of the private network, which you will use later in the
install-config.yamlfile. Repeat this procedure for each node until you have all the public MAC and IP addresses for the publicbaremetalnetwork, and the MAC addresses of the privateprovisioningnetwork.Add the MAC and IP address pair of the public
baremetalnetwork for each node into thednsmasq.hostsfilefile:$ sudo vim /var/lib/dnsmasq/dnsmasq.hostsfileExample input
00:e0:ed:6a:ca:b5,141.125.65.215,master-0 <mac>,<ip>,master-1 <mac>,<ip>,master-2 <mac>,<ip>,worker-0 <mac>,<ip>,worker-1 ...Replace
<mac>,<ip>with the public MAC address and public IP address of the corresponding node name.Start
dnsmasq:$ sudo systemctl start dnsmasqEnable
dnsmasqso that it starts when booting the node:$ sudo systemctl enable dnsmasqVerify
dnsmasqis running:$ sudo systemctl status dnsmasqExample output
● dnsmasq.service - DNS caching server. Loaded: loaded (/usr/lib/systemd/system/dnsmasq.service; enabled; vendor preset: disabled) Active: active (running) since Tue 2021-10-05 05:04:14 CDT; 49s ago Main PID: 3101 (dnsmasq) Tasks: 1 (limit: 204038) Memory: 732.0K CGroup: /system.slice/dnsmasq.service └─3101 /usr/sbin/dnsmasq -kOpen ports
53and67with UDP protocol:$ sudo firewall-cmd --add-port 53/udp --permanent$ sudo firewall-cmd --add-port 67/udp --permanentAdd
provisioningto the external zone with masquerade:$ sudo firewall-cmd --change-zone=provisioning --zone=external --permanentThis step ensures network address translation for IPMI calls to the management subnet.
Reload the
firewalldconfiguration:$ sudo firewall-cmd --reload