Merge pull request #371 from warmchang/nf_conntrack

🔧 modprobe nf_conntrack
This commit is contained in:
Darren Shepherd 2019-04-26 16:01:13 -07:00 committed by GitHub
commit 2950e81c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -267,8 +267,6 @@ After=network.target
[Service]
Type=notify
EnvironmentFile=/etc/systemd/system/k3s.service.env
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/k3s server
KillMode=process
Delegate=yes

View File

@ -4,8 +4,8 @@ Documentation=https://k3s.io
After=network.target
[Service]
ExecStartPre=-/sbin/modprobe br_netfilter
ExecStartPre=-/sbin/modprobe overlay
Type=notify
EnvironmentFile=/etc/systemd/system/k3s.service.env
ExecStart=/usr/local/bin/k3s server
KillMode=process
Delegate=yes

View File

@ -13,12 +13,26 @@ var (
)
func Configure() error {
exec.Command("modprobe", "br_netfilter").Run()
if err := exec.Command("modprobe", "br_netfilter").Run(); err != nil {
logrus.Warnf("failed to start br_netfilter module")
return nil
}
if err := ioutil.WriteFile(callIPTablesFile, []byte("1"), 0640); err != nil {
logrus.Warnf("failed to write value 1 at %s: %v", callIPTablesFile, err)
return nil
}
if err := ioutil.WriteFile(forward, []byte("1"), 0640); err != nil {
logrus.Warnf("failed to write value 1 at %s: %v", forward, err)
return nil
}
if err := exec.Command("modprobe", "overlay").Run(); err != nil {
logrus.Warnf("failed to start overlay module")
return nil
}
if err := exec.Command("modprobe", "nf_conntrack").Run(); err != nil {
logrus.Warnf("failed to start nf_conntrack module")
return nil
}
return nil
}