Skip to content

Commit

Permalink
don't block traffic generated by the root user on the node
Browse files Browse the repository at this point in the history
Kubelet has to run as root, blocking the traffic directed to Pods
by network policies can impact kubelet probes per example.

Since root user can do anything on the node, network policies are
not a security boundary for it, so don't apply them to the traffic
generated by the root user.
  • Loading branch information
aojea committed Jul 23, 2024
1 parent 2e682f0 commit dff26fe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/networkpolicy/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,13 @@ func (c *Controller) syncNFTablesRules(ctx context.Context) error {
Rule: knftables.Concat(
"icmpv6", "type", "{", "nd-neighbor-solicit, nd-neighbor-advert", "}", "accept"),
})
// Don't process traffic generated from the root user in the Node, it can block kubelet probes
// or system daemons that depend on the internal node traffic to not be blocked.
// Ref: https://github.com/kubernetes-sigs/kube-network-policies/issues/65
tx.Add(&knftables.Rule{
Chain: chainName,
Rule: "meta skuid 0 accept",
})
// instead of aggregating all the expresion in one rule, use two different
// rules to understand if is causing issues with UDP packets with the same
// tuple (https://github.com/kubernetes-sigs/kube-network-policies/issues/12)
Expand Down

0 comments on commit dff26fe

Please sign in to comment.