kubesphere / kubekey

Install Kubernetes/K3s only, both Kubernetes/K3s and KubeSphere, and related cloud-native add-ons, it supports all-in-one, multi-node, and HA 🔥 ⎈ 🐳
https://kubesphere.io
Apache License 2.0
2.37k stars 550 forks source link

vxlan+directRouting mode doesn't work coz the template here doesn't hv the directRouting option potion to ref the variables. #2199

Open lqdflying opened 7 months ago

lqdflying commented 7 months ago

https://github.com/kubesphere/kubekey/blob/d8018e03bfbd56c96723edca642cc668f30eaf5f/cmd/kk/pkg/plugins/network/templates/flannel.go#L167C1-L167C37

lqdflying commented 7 months ago

I follow the issue to revise the yaml as following:

  network:
    plugin: flannel
    flannel:
      backendMode: vxlan # [vxlan | ipip | host-gw] [Default: vxlan]
      directRouting: true  

but as per the flannel log. it still is runs as DirectRouting=false

liuqd@k8-lb:~/.kube$ kubectl logs kube-flannel-ds-5zbkl -n kube-system 
I0407 15:24:37.191067       1 main.go:211] CLI flags config: {etcdEndpoints:http://127.0.0.1:4001,http://127.0.0.1:2379 etcdPrefix:/coreos.com/network etcdKeyfile: etcdCertfile: etcdCAFile: etcdUsername: etcdPassword: version:false kubeSubnetMgr:true kubeApiUrl: kubeAnnotationPrefix:flannel.alpha.coreos.com kubeConfigFile: iface:[] ifaceRegex:[] ipMasq:true ifaceCanReach: subnetFile:/run/flannel/subnet.env publicIP: publicIPv6: subnetLeaseRenewMargin:60 healthzIP:0.0.0.0 healthzPort:0 iptablesResyncSeconds:5 iptablesForwardRules:true netConfPath:/etc/kube-flannel/net-conf.json setNodeNetworkUnavailable:true useMultiClusterCidr:false}
W0407 15:24:37.191126       1 client_config.go:617] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0407 15:24:37.290332       1 kube.go:144] Waiting 10m0s for node controller to sync
I0407 15:24:37.290451       1 kube.go:485] Starting kube subnet manager
I0407 15:24:37.510115       1 kube.go:506] Creating the node lease for IPv4. This is the n.Spec.PodCIDRs: [10.10.67.0/24]
I0407 15:24:38.293257       1 kube.go:151] Node controller sync successful
I0407 15:24:38.293282       1 main.go:231] Created subnet manager: Kubernetes Subnet Manager - k8-master1
I0407 15:24:38.293285       1 main.go:234] Installing signal handlers
I0407 15:24:38.293918       1 main.go:542] Found network config - Backend type: vxlan
I0407 15:24:38.294095       1 match.go:206] Determining IP address of default interface
I0407 15:24:38.294791       1 match.go:259] Using interface with name ens192 and address 192.168.31.91
I0407 15:24:38.294882       1 match.go:281] Defaulting external address to interface address (192.168.31.91)
I0407 15:24:38.294970       1 vxlan.go:140] VXLAN config: VNI=1 Port=0 GBP=false Learning=false DirectRouting=false
I0407 15:24:38.295635       1 kube.go:506] Creating the node lease for IPv4. This is the n.Spec.PodCIDRs: [10.10.68.0/24]
I0407 15:24:38.320450       1 kube.go:506] Creating the node lease for IPv4. This is the n.Spec.PodCIDRs: [10.10.64.0/24]
I0407 15:24:38.322945       1 kube.go:506] Creating the node lease for IPv4. This is the n.Spec.PodCIDRs: [10.10.65.0/24]
W0407 15:24:38.325749       1 main.go:595] no subnet found for key: FLANNEL_SUBNET in file: /run/flannel/subnet.env
I0407 15:24:38.325852       1 main.go:481] Current network or subnet (10.10.64.0/18, 10.10.64.0/24) is not equal to previous one (0.0.0.0/0, 0.0.0.0/0), trying to recycle old iptables rules
I0407 15:24:38.686224       1 main.go:356] Setting up masking rules
I0407 15:24:38.688847       1 main.go:407] Changing default FORWARD chain policy to ACCEPT
I0407 15:24:38.784361       1 iptables.go:274] generated 7 rules