Managing Firewall Ports
Each node's host firewall is preconfigured with the ports required by the platform. You do not need to manage these ports, and you should not modify the platform's preconfigured port list directly.
When a workload needs an additional host port to be open—for example, a third-party component that listens directly on the node—you can open it by adding a firewalld policy with a MachineConfig object. The policy is written as a separate file, so the platform's preconfigured ports are left unchanged.
Prerequisite: Verify the Firewall Backend
The procedure below applies a firewall reload, which is safe only when the host firewall uses the nftables backend. Confirm the backend on a node:
The output should be FirewallBackend=nftables. If the backend is iptables, reloading the firewall can disrupt cluster networking; in that case use a Reboot node disruption policy instead of Reload for the policy file.
Opening an Additional Port
The following example opens TCP port 19999.
-
Create the firewalld policy file. It accepts ingress from any zone to the host and opens the port:
-
Base64-encode the contents:
-
Create a
MachineConfigobject that writes the policy file under/etc/firewalld/policies/: -
Configure a node disruption policy that reloads the firewall when this file changes. Add the following to the
clusterMachineConfigurationobject in thecpaas-systemnamespace, and confirm it is reflected instatus.nodeDisruptionPolicyStatusbefore applying theMachineConfig:
After the configuration is applied, the firewall reloads and the new port is open. The node is not rebooted, and the platform's preconfigured ports remain unchanged. To close the port again, delete the MachineConfig object; the firewall reloads and the policy file is removed.