Table of Contents
Introduction
Configuring DHCP for OpenShift clusters involves setting up a DHCP server to dynamically assign IP addresses to nodes in the cluster. This ensures that each node receives a unique IP address necessary for network communication and cluster operations. Begin by configuring your DHCP server to provide IP addresses within a defined range and to assign static IPs for critical nodes if needed. Additionally, ensure that the DHCP server is configured to update DNS records and provide other necessary network information. Proper DHCP configuration is essential for maintaining the stability and functionality of your OpenShift cluster by facilitating seamless communication between nodes.
Installing Packages
Install the required DHCP package
$ dnf install dhcp-server -y
The original files doesn’t have any entries by default, however a sample configuration will be reside under /usr/share/doc/dhcp-server/
$ cat /usr/share/doc/dhcp-server/dhcpd.conf.example > /etc/dhcp/dhcpd.conf
Configure the DHCP
A simple configuration for OpenShift environment
$ vim /etc/dhcp/dhcpd.conf # option definitions common to all supported networks... option domain-name "okd.linuxsysadmins.lan"; option domain-name-servers ns1.okd.linuxsysadmins.lan; default-lease-time 600; max-lease-time 7200; log-facility local7; # DHCP server to understand the network topology. subnet 192.168.11.0 netmask 255.255.255.0 { option ntp-servers 192.168.11.100; } # Fixed IP addresses can also be specified for hosts. host control-plane { hardware ethernet BC:24:11:EC:84:07; fixed-address 192.168.11.101; option host-name "control-plane.okd.linuxsysadmins.lan"; option routers 192.168.11.1; }
Firewall exclusion
Allow the firewall exclusion for DHCP by running firewalld commands.
$ firewall-cmd --add-service=dhcp --permanent
$ firewall-cmd --reload
Start and enable the service persistently
$ systemctl start dhcpd
$ systemctl enable dhcpd
That’s it, we are done with setting up a simple DHCP server.