欢迎光临
我们一直在努力

K8s服务kube-flannel组件日志报错Unable to find default route

在部署k8s时,存在报错

[root@localhost ~]# kubectl logs -n kube-system kube-flannel-nlljz
I0821 08:50:35.175250       1 main.go:217] 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: help:false version:false autoDetectIPv4:false autoDetectIPv6:false kubeSubnetMgr:true kubeApiUrl: kubeAnnotationPrefix:flannel.alpha.coreos.com kubeConfigFile: iface:[] ifaceRegex:[] ipMasq:true subnetFile:/run/flannel/subnet.env subnetDir: publicIP: publicIPv6: subnetLeaseRenewMargin:60 healthzIP:0.0.0.0 healthzPort:0 charonExecutablePath: charonViciUri: iptablesResyncSeconds:5 iptablesForwardRules:true netConfPath:/etc/kube-flannel/net-conf.json setNodeNetworkUnavailable:true}
W0821 08:50:35.175317       1 client_config.go:608] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0821 08:50:35.265525       1 kube.go:120] Waiting 10m0s for node controller to sync
I0821 08:50:35.265582       1 kube.go:378] Starting kube subnet manager
I0821 08:50:36.266121       1 kube.go:127] Node controller sync successful
I0821 08:50:36.266167       1 main.go:237] Created subnet manager: Kubernetes Subnet Manager - node1
I0821 08:50:36.266172       1 main.go:240] Installing signal handlers
I0821 08:50:36.266355       1 main.go:459] Found network config - Backend type: vxlan
I0821 08:50:36.266385       1 main.go:651] Determining IP address of default interface
E0821 08:50:36.266748       1 main.go:276] Failed to find any valid interface to use: failed to get default interface: Unable to find default route
[root@localhost ~]# kubectl logs -n kube-system kube-flannel-nlljz
I0821 08:50:35.175250       1 main.go:217] 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: help:false version:false autoDetectIPv4:false autoDetectIPv6:false kubeSubnetMgr:true kubeApiUrl: kubeAnnotationPrefix:flannel.alpha.coreos.com kubeConfigFile: iface:[] ifaceRegex:[] ipMasq:true subnetFile:/run/flannel/subnet.env subnetDir: publicIP: publicIPv6: subnetLeaseRenewMargin:60 healthzIP:0.0.0.0 healthzPort:0 charonExecutablePath: charonViciUri: iptablesResyncSeconds:5 iptablesForwardRules:true netConfPath:/etc/kube-flannel/net-conf.json setNodeNetworkUnavailable:true}
W0821 08:50:35.175317       1 client_config.go:608] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0821 08:50:35.265525       1 kube.go:120] Waiting 10m0s for node controller to sync
I0821 08:50:35.265582       1 kube.go:378] Starting kube subnet manager
I0821 08:50:36.266121       1 kube.go:127] Node controller sync successful
I0821 08:50:36.266167       1 main.go:237] Created subnet manager: Kubernetes Subnet Manager - node1
I0821 08:50:36.266172       1 main.go:240] Installing signal handlers
I0821 08:50:36.266355       1 main.go:459] Found network config - Backend type: vxlan
I0821 08:50:36.266385       1 main.go:651] Determining IP address of default interface
E0821 08:50:36.266748       1 main.go:276] Failed to find any valid interface to use: failed to get default interface: Unable to find default route

从日志看来,一个主要的问题是 kube-flannel 无法找到默认的网络接口或默认路由。需要检查以下几个方面:

  • 确保 Kubernetes 集群节点的网络配置正确。
  • 检查节点是否有可用的网络接口。
  • 确保节点有默认路由。

问题排查

经过排查,是由于服务器没有默认路由导致的。通过执行以下命令查看:

[admin@localhost ~]$ ip route show default
default via 192.168.2.3 dev ens160 proto static metric 100

其他命令:

ip addr
ip route
kubectl get nodes

文章来源于互联网:K8s服务kube-flannel组件日志报错Unable to find default route

赞(0)
未经允许不得转载:莱卡云 » K8s服务kube-flannel组件日志报错Unable to find default route