我创建了一个具有 3 个工作节点的 Kubernetes 集群,并且在使用 Flannal 时遇到了持续的 CrashLoopBackoff 问题:
kube-flannel kube-flannel-ds-7lc76 0/1 CrashLoopBackOff 7 (4m52s ago) 15m
kube-flannel kube-flannel-ds-j8rnz 0/1 CrashLoopBackOff 7 (4m29s ago) 15m
kube-flannel kube-flannel-ds-jg4bt 0/1 CrashLoopBackOff 7 (4m15s ago) 15m
kube-flannel kube-flannel-ds-vnnmt 0/1 CrashLoopBackOff 7 (5m1s ago) 15m
检查日志后,提到了一个问题VXLAN
,但并没有透露更多信息:
Defaulted container "kube-flannel" out of: kube-flannel, install-cni-plugin (init), install-cni (init)
I0728 14:30:25.837078 1 main.go:212] 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}
W0728 14:30:25.837347 1 client_config.go:617] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I0728 14:30:25.867779 1 kube.go:145] Waiting 10m0s for node controller to sync
I0728 14:30:25.867978 1 kube.go:489] Starting kube subnet manager
I0728 14:30:26.868868 1 kube.go:152] Node controller sync successful
I0728 14:30:26.869136 1 main.go:232] Created subnet manager: Kubernetes Subnet Manager - ts-k8s-master
I0728 14:30:26.869155 1 main.go:235] Installing signal handlers
I0728 14:30:26.869728 1 main.go:543] Found network config - Backend type: vxlan
I0728 14:30:26.869781 1 match.go:206] Determining IP address of default interface
I0728 14:30:26.870814 1 match.go:259] Using interface with name eth0 and address 10.0.0.100
I0728 14:30:26.870893 1 match.go:281] Defaulting external address to interface address (10.0.0.100)
I0728 14:30:26.871025 1 vxlan.go:141] VXLAN config: VNI=1 Port=0 GBP=false Learning=false DirectRouting=false
E0728 14:30:26.876691 1 main.go:335] Error registering network: operation not supported
I0728 14:30:26.876887 1 main.go:523] Stopping shutdownHandler...
以下错误消息让我怀疑这是否兼容。我在 ARM64 系统(4 x RaspPi4)上运行,但已按照说明操作这里。
Error registering network: operation not supported
我的路由器网关 IP 为 10.0.0.1,子网为 255.0.0.0。主节点位于 10.0.0.100,工作节点位于 10.0.0.101+。我kubeadm init
按照pod-network-cidr=10.244.0.0/16
说明创建了集群。
然而,我确实收到了一个问题,kube-proxy
无法找到 Flannel 配置(/run/flannel/subnet.env
),这可能指向一个更深层次的问题(也许与守护进程有关?),因此手动创建了具有以下内容的文件:
FLANNEL_NETWORK=10.244.0.0/16
FLANNEL_SUBNET=10.244.0.1/24
FLANNEL_MTU=1450
FLANNEL_IPMASQ=true
我不知道该如何继续,因为这似乎是在 Flannel 内部更深层次的问题。
了解 coredns 确实具有来自 pod network\Flannel 范围的 pod 可能会很有用:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
coredns-5d78c9869d-7vhqh 1/1 Running 1 (105m ago) 4h32m 10.244.0.2 ts-k8s-master <none> <none>
coredns-5d78c9869d-x8r79 1/1 Running 1 (105m ago) 4h32m 10.244.0.3 ts-k8s-master <none> <none>