diff --git a/README.md b/README.md index 5b0dbb934..9f577e173 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ curl -O -L https://github.com/containernetworking/plugins/releases/download/v1.5 tar -C /opt/cni/bin -xzf cni-plugins-linux-$ARCH-v1.5.1.tgz ``` +Flannel requires the br_netfilter module to start and from version 1.30 kubeadm doesn't check if the module is installed and Flannel will not rightly start in case the module is missing. + ## Getting started on Docker flannel is also widely used outside of kubernetes. When deployed outside of kubernetes, etcd is always used as the datastore. For more details integrating flannel with Docker see [Running](Documentation/running.md) diff --git a/main.go b/main.go index 70afde36c..2bac2b196 100644 --- a/main.go +++ b/main.go @@ -261,6 +261,20 @@ func main() { os.Exit(1) } + // From Kubernetes 1.30 kubeadm doesn't check if the br_netfilter module is loaded and in case it's missing Flannel wrongly starts + if config.EnableIPv4 { + if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-iptables"); os.IsNotExist(err) { + log.Error("Failed to check br_netfilter: ", err) + os.Exit(1) + } + } + if config.EnableIPv6 { + if _, err = os.Stat("/proc/sys/net/bridge/bridge-nf-call-ip6tables"); os.IsNotExist(err) { + log.Error("Failed to check br_netfilter: ", err) + os.Exit(1) + } + } + // Work out which interface to use var extIface *backend.ExternalInterface