K3s Firewall Rules
You set up k3s firewall rules by opening the configured port on the server node. You must also open the overlay network port between all cluster nodes. Teams often start by opening wide subnet ranges to make node setup fast. That broad rule lets any host on the local network reach the cluster API. When teams share broad network access and wide cluster roles, small mistakes cause outages. How k3s firewall rules work across nodes A K3s cluster splits traffic between control plane requests and n
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up k3s firewall rules by opening the configured port on the server node. You must also open the overlay network port between all cluster nodes. Teams often start by opening wide subnet ranges to make node setup fast. That broad rule lets any host on the local network reach the cluster API. When teams share broad network access and wide cluster roles, small mistakes cause outages.
How k3s firewall rules work across nodes
A K3s cluster splits traffic between control plane requests and node overlay traffic. Worker nodes send API requests to the server node on TCP the configured port. Engineers and deploy tools also use the configured port to run cluster commands. Your firewall must allow inbound traffic on this port from trusted IP addresses.
Nodes also need a clear path for pod-to-pod traffic across the cluster. Most setups use a VXLAN overlay network on UDP the configured port between nodes. If you use an embedded etcd database, nodes need TCP ports 2379 and 2380. The kubelet service on each node also listens on TCP the configured port for metrics. Your host firewall should allow these ports only between known cluster node addresses.
Linux hosts often run firewalld or ufw on top of the kernel packet filter. Those tools can drop pod traffic if they block the virtual bridge interface. You must add a rule that trusts traffic on the pod network subnet. You also need outbound access so nodes can pull container images from registries.
Separating user traffic from node traffic
Good network design separates internal node ports from human and automation API ports. Worker nodes only need to talk to other nodes in the same cluster. You can group all node IP addresses into a single firewall security group. That group allows VXLAN, kubelet, and etcd ports only between member hosts.
The configured port is different because both worker nodes and human engineers use it. Teams often restrict human access on the configured port to an office or VPN range. Once a user crosses that network boundary, the firewall does no further checks. The cluster API then relies on client certificates or bearer tokens to check identity.
AWS Config Rules + Firewall Configuration: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
What network rules solve and what they miss
Host firewall rules stop outside attackers from scanning or reaching your cluster nodes. They keep database sync ports and overlay packets private to your own machines. A solid port setup prevents random hosts from joining or probing the cluster.
Still, a packet filter only checks IP addresses and port numbers at the edge. Once an engineer reaches the configured port, the firewall allows every API request through. It cannot tell a safe pod read request from a command that deletes workloads. It also cannot read inside an exec stream when someone opens a container shell.
Teams often give engineers broad cluster roles to help them fix broken apps fast. Those static kubeconfig files stay on laptops and bypass further network checks over VPN. If a user runs a bad command or reads secret values, the firewall allows it. Masking tools that rewrite emails, phone numbers, card numbers, or national IDs in results are absent. Network rules decide who reaches the port, not what commands run inside the cluster.
Add request guardrails and response masking beside Kubernetes
Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.
With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.
Frequently asked questions
Which port do worker nodes need to join a K3s server?
Worker nodes need outbound access to TCP the configured port on the server node. They also need UDP the configured port open between nodes for default VXLAN traffic.
Why do pods fail to talk to each other when the firewall is on?
Host firewalls often block traffic moving across the virtual container bridge interface by default. You must allow traffic from the pod CIDR range and open UDP the configured port.
Do k3s firewall rules control which Kubernetes commands an engineer can run?
No, a firewall only controls which IP addresses can reach the API port. Once traffic passes the configured port, cluster roles and command controls govern what actions run.
Related guides
In this post