- Home
- Getting started
- Configure firewalld
Configure firewalld#
MKE 4 does not manage firewalld rules. In its default configuration, firewalld
blocks the MKE 4 node ports and rejects forwarded pod traffic between nodes. As
a result, all nodes reach the Ready state, but pods cannot communicate across
nodes.
About the firewalld check#
The following operations check Linux nodes for firewalld:
- The
mkectl applycommand checks each Linux node. - The
mkectl node addcommand checks each Linux node that it adds to the cluster. - The
mkectl upgradecommand checks each Linux node when you upgrade from MKE 3. Upgrades between MKE 4 versions do not check for firewalld.
For information about the firewalld rule that MKE 3 leaves in place after an upgrade, refer to Firewalld rules from MKE 3.
The check fails if firewalld is active or enabled on any checked node, and the
command lists the affected nodes. When you run the mkectl apply command on an
existing cluster, the command logs a warning instead of failing.
Note
The mkectl node add command fails the firewalld check even on an existing
cluster. Configure firewalld on each new node before you add it to the
cluster.
Warning
MKE 4 checks for firewalld only during the preceding operations. If you enable firewalld on a node after the node joins the cluster, pods on that node cannot communicate with pods on other nodes, and MKE 4 does not warn you. Configure firewalld for MKE 4 before you enable it on any cluster node.
To resolve a check failure, either disable firewalld or configure firewalld for MKE 4.
Disable firewalld#
To stop and disable firewalld, run the following command on each affected node:
sudo systemctl disable --now firewalld
Configure firewalld for MKE 4#
MKE 4 requires the following ports:
| Port | Protocol | Nodes | Purpose |
|---|---|---|---|
6443 |
TCP | Controllers | Kubernetes API server |
2380 |
TCP | Controllers | etcd peer communication |
9443 |
TCP | Controllers | Controller join API |
10250 |
TCP | All | kubelet API |
4789 |
UDP | All | Calico VXLAN |
5473 |
TCP | All | Calico Typha |
80 |
TCP | All | Networking check |
179 |
TCP | All | BGP, if enabled |
7946 |
TCP, UDP | All | MetalLB, if enabled |
Configure firewalld so that it allows MKE 4 node traffic and forwarded pod traffic:
-
On each node, identify the network interface that carries the IP address of the node:
ip -o addr show | grep <node-ip-address>The interface name is the second field of the output.
-
Identify the firewalld zone of the network interface:
sudo firewall-cmd --get-zone-of-interface=<interface>If the interface is not bound to a zone, use the default zone:
sudo firewall-cmd --get-default-zone -
On each node, open the MKE 4 node ports in that zone:
-
On controller nodes:
sudo firewall-cmd --permanent --zone=<zone> \ --add-port=6443/tcp --add-port=2380/tcp --add-port=9443/tcp \ --add-port=10250/tcp --add-port=4789/udp --add-port=5473/tcp \ --add-port=80/tcp -
On worker nodes:
sudo firewall-cmd --permanent --zone=<zone> \ --add-port=10250/tcp --add-port=4789/udp --add-port=5473/tcp \ --add-port=80/tcp
Adjust the ports to your cluster configuration:
- If the cluster uses BGP, also open port
179/tcpon all nodes. - If MetalLB is enabled, also open ports
7946/tcpand7946/udpon all nodes. - If you set a networking check port other than the default with the
--cni-check-portflag, open that port instead of80/tcp.
-
-
On each node, add the pod network CIDR to the
trustedzone to allow forwarded pod traffic. If you upgraded from MKE 3, thetrustedzone might already contain the pod network CIDR. For more information, refer to Firewalld rules from MKE 3.If the Calico
values.yamlsets an IP pool ininstallation.calicoNetwork.ipPools, the pod network CIDR is the CIDR of that pool. Otherwise, the pod network CIDR is thecidrV4setting, which defaults to192.168.0.0/16. For more information, refer to Configure CNI providers.sudo firewall-cmd --permanent --zone=trusted --add-source=<pod-cidr> -
If the cluster uses the Calico eBPF data plane, add the IP address of the node to the
trustedzone as a/32source:sudo firewall-cmd --permanent --zone=trusted --add-source=<node-ip-address>/32 -
Reload firewalld to apply the permanent rules:
sudo firewall-cmd --reload -
Verify that the zones contain the expected ports and sources:
sudo firewall-cmd --zone=<zone> --list-ports sudo firewall-cmd --zone=trusted --list-sources -
Run the
mkectlcommand again with the--skip-firewalld-checkflag. The check fails whenever firewalld is active, regardless of its rules, so you must skip the check after you configure firewalld.
Firewalld rules from MKE 3#
On nodes that run firewalld, MKE 3 adds its pod network CIDR to the firewalld
trusted zone. This CIDR is the MKE 3 pod_cidr setting, which defaults to
192.168.0.0/16. The upgrade to MKE 4 leaves this rule in place, but MKE 4
does not manage it.
To check whether a node has the rule, list the sources of the trusted zone:
sudo firewall-cmd --zone=trusted --list-sources
If you keep firewalld and the rule is present, the pod network is already trusted, so you can skip step 4 of Configure firewalld for MKE 4. You must still open the MKE 4 ports and, on the Calico eBPF data plane, trust the IP address of each node.
Warning
The rule trusts all traffic from the pod network CIDR on every interface. If that range overlaps a network that the node is attached to, every host on that network has unfiltered access to the node, as it did in MKE 3.
MKE 4 does not remove the rule when you reset a node or remove it from the cluster. To remove the rule, run the following commands on the node:
sudo firewall-cmd --permanent --zone=trusted --remove-source=<mke3-pod-cidr>
sudo firewall-cmd --reload