Skip to content

Commit ff079d2

Browse files
committed
Enable netfilter for bridge, requirement for all CNI that use bridge
https://kubernetes.io/docs/concepts/cluster-administration/network-plugins/#network-plugin-requirements Fixes #141
1 parent 5951f55 commit ff079d2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/controllers/network_routes_controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package controllers
33
import (
44
"errors"
55
"fmt"
6+
"io/ioutil"
67
"net"
78
"net/url"
89
"os/exec"
@@ -94,6 +95,14 @@ func (nrc *NetworkRoutingController) Run(stopCh <-chan struct{}, wg *sync.WaitGr
9495
glog.Errorf("Failed to enable IP forwarding of traffic from pods: %s", err.Error())
9596
}
9697

98+
// enable netfilter for the bridge
99+
if _, err := exec.Command("modprobe", "br_netfilter").CombinedOutput(); err != nil {
100+
glog.Errorf("Failed to enable netfilter for bridge. Network policies and service proxy may not work: %s", err.Error())
101+
}
102+
if err = ioutil.WriteFile("/proc/sys/net/bridge/bridge-nf-call-iptables", []byte(strconv.Itoa(1)), 0640); err != nil {
103+
glog.Errorf("Failed to enable netfilter for bridge. Network policies and service proxy may not work: %s", err.Error())
104+
}
105+
97106
t := time.NewTicker(nrc.syncPeriod)
98107
defer t.Stop()
99108
defer wg.Done()

0 commit comments

Comments
 (0)