flannel icon indicating copy to clipboard operation
flannel copied to clipboard

Flannel pod creation failed

Open githuber196 opened this issue 9 months ago • 3 comments

I use the official yml file to deploy the flannel plug-in through kubeclt apply -f, but the pod status is always error, and there is no clear error information in the kubectl logs. I checked the br_netfilter module according to the flannel installation requirements, the cni plug-in is also installed, and the vxlan module is also loaded. The firewall is turned off. What is going on?

kubectl logs kube-flannel-ds-6s9xx -n kube-flannel
Defaulted container "kube-flannel" out of: kube-flannel, install-cni-plugin (init), install-cni (init)
I0404 08:02:26.321280       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}
W0404 08:02:26.323314       1 client_config.go:618] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
I0404 08:02:26.427615       1 kube.go:469] Starting kube subnet manager
I0404 08:02:26.427896       1 kube.go:139] Waiting 10m0s for node controller to sync

githuber196 avatar Apr 04 '25 08:04 githuber196

If you do a pod describe what error do you get from kubelet?

rbrtbnfgl avatar Apr 10 '25 10:04 rbrtbnfgl

edit kube-flannel.yml 's DaemonSet , add the enviroment var KUBERNETES_SERVICE_HOST and KUBERNETES_SERVICE_PORT:

containers:
      - args:
        - --ip-masq
        - --kube-subnet-mgr
        command:
        - /opt/bin/flanneld
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: EVENT_QUEUE_DEPTH
          value: "5000"
        - name: FLANNELD_IFACE
          value: "ens33"
        # let's kube-flannel-ds connect API Server on node 's IPV6 address 
        - name: KUBERNETES_SERVICE_HOST
          value: "192.168.186.40"
        - name: KUBERNETES_SERVICE_PORT
          value: "6443"
        image: ghcr.io/flannel-io/flannel:v0.26.7
        name: kube-flannel

mosaicwang avatar Jun 03 '25 00:06 mosaicwang