Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

servicelb bypassing node's firewall #75

Open
tymur999 opened this issue Jan 3, 2025 · 2 comments
Open

servicelb bypassing node's firewall #75

tymur999 opened this issue Jan 3, 2025 · 2 comments

Comments

@tymur999
Copy link

tymur999 commented Jan 3, 2025

I have deployed an email server on my cluster through ServiceLB and have disallowed port 25 on some nodes, yet I am still able to connect to the email server on those nodes.

I am using UFW with iptables backend, so I assume that the iptable block is being overwritten by the forwarding done by ServiceLB.

Is there any way to restrict this specific loadbalancer instance to attach to certain nodes, or to ensure the firewall still works even with ServiceLB?

@tymur999
Copy link
Author

tymur999 commented Jan 3, 2025

I have found this section in the k3s website that allows assigning an LB to certain nodes

Creating ServiceLB Node Pools

To select a particular subset of nodes to host pods for a LoadBalancer, add the enablelb label to the desired nodes, and set matching lbpool label values on the Nodes and Services. For example:

Label Node A and Node B with svccontroller.k3s.cattle.io/lbpool=pool1 and svccontroller.k3s.cattle.io/enablelb=true
Label Node C and Node D with svccontroller.k3s.cattle.io/lbpool=pool2 and svccontroller.k3s.cattle.io/enablelb=true
Create one LoadBalancer Service on port 443 with label svccontroller.k3s.cattle.io/lbpool=pool1. The DaemonSet for this service only deploy Pods to Node A and Node B.
Create another LoadBalancer Service on port 443 with label svccontroller.k3s.cattle.io/lbpool=pool2. The DaemonSet will only deploy Pods to Node C and Node D.

However I would like to also to assign an LB to all nodes without firewall rules being overwritten. Is this possible?

@dereknola
Copy link
Member

K3s uses iptables for the forwarding with both servicelb as well as kube-proxy and the CNI itself like flannel. It does not play nicely with UFW or other firewalls and does not consider them when making rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants