diff --git a/cmd/hepto/service.go b/cmd/hepto/service.go index 028752bb1365b4a35a106d991d7eadab3419cc82..5d36efa67a4f89934ea5d4497776d35b1b2ea612 100644 --- a/cmd/hepto/service.go +++ b/cmd/hepto/service.go @@ -4,6 +4,7 @@ import ( "fmt" "net" "os" + "os/exec" "path" "time" @@ -51,6 +52,26 @@ var Start = &cobra.Command{ return err } } + // Load useful kernel modules for later operations + // This uses exec at the moment, which is undesireable in case hepto is used in a very + // limited environment + desiredModules := []string{ + "nf_conntrack", // Required by most CNI + "ip6_tables", // Required by kube-router, kube-proxy, Calico, and even Cilium + "ip6table_filter", + "ip6table_nat", + "ip6table_mangle", + "ip_tables", // Not used since hepto is IPv6 only, but required by most CNI + "iptable_filter", + "iptable_nat", + "iptable_mangle", + } + for _, mod := range desiredModules { + err := exec.Command("modprobe", "--", mod).Run() + if err != nil { + return err + } + } return nil }, RunE: func(cmd *cobra.Command, args []string) error {