Ensure that br_netfilter module is loaded

This commit is contained in:
Darren Shepherd 2019-01-25 21:52:29 -07:00
parent ce93f17e28
commit 3f2a951564
3 changed files with 4 additions and 0 deletions

View File

@ -199,6 +199,7 @@ Documentation=https://k3s.io
After=network.target After=network.target
[Service] [Service]
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server ExecStart=/usr/local/bin/k3s server
KillMode=process KillMode=process

View File

@ -4,6 +4,7 @@ Documentation=https://k3s.io
After=network.target After=network.target
[Service] [Service]
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server ExecStart=/usr/local/bin/k3s server
KillMode=process KillMode=process

View File

@ -2,6 +2,7 @@ package syssetup
import ( import (
"io/ioutil" "io/ioutil"
"os/exec"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
) )
@ -11,6 +12,7 @@ var (
) )
func Configure() error { func Configure() error {
exec.Command("modprobe", "br_netfilter").Run()
if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil { if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil {
logrus.Warnf("failed to write value 1 at %s: %v", callIPTablesFile, err) logrus.Warnf("failed to write value 1 at %s: %v", callIPTablesFile, err)
} }