@@ -109,6 +109,26 @@ func (r *CRIO) Active() bool {
109
109
return r .Init .Active ("crio" )
110
110
}
111
111
112
+ // enableIPForwarding configures IP forwarding, which is handled normally by Docker
113
+ // Context: https://github.com/kubernetes/kubeadm/issues/1062
114
+ func enableIPForwarding (cr CommandRunner ) error {
115
+ // The bridge-netfilter module enables iptables rules to work on Linux bridges
116
+ // NOTE: br_netfilter isn't available in WSL2, but forwarding works fine there anyways
117
+ c := exec .Command ("sudo" , "sysctl" , "net.bridge.bridge-nf-call-iptables" )
118
+ if rr , err := cr .RunCmd (c ); err != nil {
119
+ klog .Infof ("couldn't verify netfilter by %q which might be okay. error: %v" , rr .Command (), err )
120
+ c = exec .Command ("sudo" , "modprobe" , "br_netfilter" )
121
+ if _ , err := cr .RunCmd (c ); err != nil {
122
+ klog .Warningf ("%q failed, which may be ok: %v" , rr .Command (), err )
123
+ }
124
+ }
125
+ c = exec .Command ("sudo" , "sh" , "-c" , "echo 1 > /proc/sys/net/ipv4/ip_forward" )
126
+ if _ , err := cr .RunCmd (c ); err != nil {
127
+ return errors .Wrapf (err , "ip_forward" )
128
+ }
129
+ return nil
130
+ }
131
+
112
132
// Enable idempotently enables CRIO on a host
113
133
func (r * CRIO ) Enable (disOthers , _ bool ) error {
114
134
if disOthers {
0 commit comments