找回密码
 注册
查看: 10|回复: 0

Kube flannel in CrashLoopBackOff status 解决办法

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2025-1-2 17:00:00 | 显示全部楼层 |阅读模式
kubectl describe pod -n kube-system kube-flannel-ds-amd64-42rl7
) f( |' E- V' i  v7 z& B$ c: `. Z
7 z: K) F7 }4 U3 k2 d- W
  s9 T/ b$ P/ ]* F) r0 G5 W
  @  @( u# v1 M0 F: Y
- m! k- c% t* e: o% r! W; h& b
Name:               kube-flannel-ds-amd64-42rl7Namespace:         ' `1 @+ _0 |. i4 A: S
kube-systemPriority:           0PriorityClassName:  <none>. D) f! k9 v, G/ P1 n: k+ W
Node:               node5/10.168.209.17
' Q" ]9 C; B) SStart Time:         Wed, 22 Aug 2018 16:47:10 +0300Labels:             app=flannel                    controller-revision-hash=911701653                    pod-template-generation=1                    tier=nodeAnnotations:        <none>Status:             RunningIP:                 10.168.209.17Controlled By:      DaemonSet/kube-flannel-ds-amd64Init Containers:  install-cni:    Container ID:  docker://eb7ee47459a54d401969b1770ff45b39dc5768b0627eec79e189249790270169    Image:         quay.io/coreos/flannel:v0.10.0-amd64    Image ID:      docker-pullable://quay.io/coreos/flannel@sha256:88f2b4d96fae34bfff3d46293f7f18d1f9f3ca026b4a4d288f28347fcb6580ac    Port:          <none>    Host Port:     <none>    Command:      cp    Args:      -f      /etc/kube-flannel/cni-conf.json      /etc/cni/net.d/10-flannel.conflist    State:          Terminated      Reason:       Completed      Exit Code:    0      Started:      Wed, 22 Aug 2018 16:47:24 +0300      Finished:     Wed, 22 Aug 2018 16:47:24 +0300    Ready:          True    Restart Count:  0    Environment:    <none>    Mounts:      /etc/cni/net.d from cni (rw)      /etc/kube-flannel/ from flannel-cfg (rw)      /var/run/secrets/kubernetes.io/serviceaccount from flannel-token-9wmch (ro)Containers:  kube-flannel:    Container ID:  docker://521b457c648baf10f01e26dd867b8628c0f0a0cc0ea416731de658e67628d54e    Image:         quay.io/coreos/flannel:v0.10.0-amd64    Image ID:      docker-pullable://quay.io/coreos/flannel@sha256:88f2b4d96fae34bfff3d46293f7f18d1f9f3ca026b4a4d288f28347fcb6580ac    Port:          <none>    Host Port:     <none>    Command:      /opt/bin/flanneld    Args:      --ip-masq      --kube-subnet-mgr    State:          Waiting      Reason:       CrashLoopBackOff    Last State:     Terminated      Reason:       Error      Exit Code:    1      Started:      Thu, 30 Aug 2018 10:15:04 +0300      Finished:     Thu, 30 Aug 2018 10:15:08 +0300    Ready:          False    Restart Count:  2136    Limits:      cpu:     100m      memory:  50Mi    Requests:      cpu:     100m      memory:  50Mi    Environment:      POD_NAME:       kube-flannel-ds-amd64-42rl7 (v1:metadata.name)      POD_NAMESPACE:  kube-system (v1:metadata.namespace)    Mounts:      /etc/kube-flannel/ from flannel-cfg (rw)      /run from run (rw)      /var/run/secrets/kubernetes.io/serviceaccount from flannel-token-9wmch (ro)Conditions:  Type              Status  Initialized       True  Ready             False  ContainersReady   False  PodScheduled      TrueVolumes:  run:    Type:          HostPath (bare host directory volume)    Path:          /run    HostPathType:  cni:    Type:          HostPath (bare host directory volume)    Path:          /etc/cni/net.d    HostPathType:  flannel-cfg:    Type:      ConfigMap (a volume populated by a ConfigMap)    Name:      kube-flannel-cfg    Optional:  false  flannel-token-9wmch:    Type:        Secret (a volume populated by a Secret)    SecretName:  flannel-token-9wmch    Optional:    falseQoS Class:       GuaranteedNode-Selectors:  beta.kubernetes.io/arch=amd64Tolerations:     node-role.kubernetes.io/master:NoSchedule                 node.kubernetes.io/disk-pressure:NoSchedule                 node.kubernetes.io/memory-pressure:NoSchedule                 node.kubernetes.io/not-ready:NoExecute                 node.kubernetes.io/unreachable:NoExecuteEvents:  Type     Reason   Age                  From            Message  ----     ------   ----                 ----            -------  Normal   Pulled   51m (x2128 over 7d)  kubelet, node5  Container image "quay.io/coreos/flannel:v0.10.0-amd64" already present on machine  Warning  BackOff  1m (x48936 over 7d)  kubelet, node5  Back-off restarting failed container
7 o1 J8 f1 @& J7 P
* Q$ }1 z9 T4 ]8 [检查kube-controller-manager.yaml

, W# {( P8 u5 v& r6 _% o' t1 k) ]0 B* V

: j* A) ?$ g9 N4 I:apiVersion: v1, e; N- `6 t0 S5 g$ t8 R3 a
kind: Podmetadata:  annotations:    scheduler.alpha.kubernetes.io/critical-pod: ""  creationTimestamp: null  labels:    component: kube-controller-manager    tier: control-plane  name: kube-controller-manager  namespace: kube-systemspec:  containers:  - command:    - kube-controller-manager    - --address=127.0.0.1    - --allocate-node-cidrs=true    - --cluster-cidr=192.168.0.0/24    - --cluster-signing-cert-file=/etc/kubernetes/pki/ca.crt    - --cluster-signing-key-file=/etc/kubernetes/pki/ca.key    - --controllers=*,bootstrapsigner,tokencleaner    - --kubeconfig=/etc/kubernetes/controller-manager.conf    - --leader-elect=true    - --node-cidr-mask-size=24    - --root-ca-file=/etc/kubernetes/pki/ca.crt    - --service-account-private-key-file=/etc/kubernetes/pki/sa.key    - --use-service-account-credentials=true    image: k8s.gcr.io/kube-controller-manager-amd64:v1.11.2    imagePullPolicy: IfNotPresent    livenessProbe:      failureThreshold: 8      httpGet:        host: 127.0.0.1        path: /healthz        port: 10252        scheme: HTTP      initialDelaySeconds: 15      timeoutSeconds: 15    name: kube-controller-manager    resources:      requests:        cpu: 200m    volumeMounts:    - mountPath: /etc/ssl/certs      name: ca-certs      readOnly: true    - mountPath: /etc/kubernetes/controller-manager.conf      name: kubeconfig      readOnly: true    - mountPath: /usr/libexec/kubernetes/kubelet-plugins/volume/exec      name: flexvolume-dir    - mountPath: /etc/pki      name: etc-pki      readOnly: true    - mountPath: /etc/kubernetes/pki      name: k8s-certs      readOnly: true  hostNetwork: true  priorityClassName: system-cluster-critical  volumes:  - hostPath:      path: /etc/ssl/certs      type: DirectoryOrCreate    name: ca-certs  - hostPath:      path: /etc/kubernetes/controller-manager.conf      type: FileOrCreate    name: kubeconfig  - hostPath:      path: /usr/libexec/kubernetes/kubelet-plugins/volume/exec      type: DirectoryOrCreate    name: flexvolume-dir  - hostPath:      path: /etc/pki      type: DirectoryOrCreate    name: etc-pki  - hostPath:      path: /etc/kubernetes/pki      type: DirectoryOrCreate    name: k8s-certsstatus: {}
1 z; ^% S+ [( R5 T* v  O# f  w2 k* m: [, J, |+ ]2 Y) }
kubectl logs --namespace kube-system kube-flannel-ds-amd64-5fx2

2 d7 y* X! \7 z7 w7 T  s; t% X' z7 ^9 H- s2 {- U5 d5 R2 h- u
+ w! U; c* w! `" L) q
pmain.go:475] Determining IP address of default interfacemain.go:488]
* R5 r6 o, r' D# |7 E4 h, |0 `0 m2 k
7 u. Y3 d3 R# s- y! S# K
Using interface with name eth0 and address 10.168.209.14main.go:505] Defaulting external address to interface address (10.168.209.14)kube.go:131] Waiting 10m0s for node controller to synckube.go:294] Starting kube subnet managerkube.go:138] Node controller sync successfulmain.go:235] Created subnet manager: Kubernetes Subnet Manager - node2main.go:238] Installing signal handlersmain.go:353] Found network config - Backend type: vxlanvxlan.go:120] VXLAN config: VNI=1 Port=0 GBP=false DirectRouting=falsemain.go:280] Error registering network: failed to acquire lease: node "node2" pod cidr not assignedmain.go:333] Stopping shutdownHandler...3 W% _  I9 E% D5 N4 ]$ d

1 O6 z# a4 l$ T, k

! b/ z& x8 \& X* l+ F" ^6 u7 ]
3 `% A, _* u  x, `% {& z" \
$ X6 E+ Y( m) T9 @4 B$ b
cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep -i cluster-cidr- --cluster-cidr=172.168.10.0/24
+ c' O- c; Q- s! T; [# @: a, X6 j) w3 [. n2 w

' N5 T% E4 N  u3 U) {1 f  q( O8 c8 [. w
kubectl patch node podname -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'
' J1 d$ @8 |* j5 T( ?/ ~
* L6 z- V/ e  r. S
7 L. F9 a; }7 x. [
例如:kubectl patch node slave-node-1 -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'
" A0 R( T9 v4 @1 k& F
1 z1 {! r5 v' C% Z8 C& A
1 w+ Z& _9 Z3 V5 u
sudo ifconfig cni0 down;
' Z6 R5 l& Q# jsudo ifconfig flannel.1 down;& C& a1 N2 V: E4 ~4 c+ X
sudo ip link delete cni0;
# T& n* {4 L% O, a2 @+ b9 f& Zsudo ip link delete flannel.1;
To fix this, please following the step below:
  • Step 0: Reset all Nodes within your Cluster. Run all nodes with& w) i8 W! ^5 D% C* F$ c  y3 t
kubeadm reset --force;
  • Step 1: Down Interface cni0 and flannel.1.
    $ U, r) c) m! Q- K& I! r& d2 g
sudo ifconfig cni0 down;) P2 R+ m8 d, _- t: K3 _3 J
sudo ifconfig flannel.1 down;
  • Step 2: Delete Interface cni0 and flannel.1.% {( ^+ @: F( i0 Q  i
sudo ip link delete cni0;
" k! c. {, ?. i8 L0 I' Bsudo ip link delete flannel.1;
  • Step 3: Remove all items within /etc/cni/net.d/.
    ! Z8 N- G) b7 y( c5 j2 E
sudo rm -rf /etc/cni/net.d/;
  • Step 4: Re-Bootstrap your Kubernetes Cluster again.2 {2 |5 ?( s! l3 a: B1 P/ m
kubeadm init --control-plane-endpoint="..." --pod-network-cidr=10.244.0.0/16;
  • Step 5: Re-deploy CNIs.
    6 Q4 M6 H1 Z/ ^, t
  • Step 6: Restart your CNIs, here I used Container Daemon (Containerd).
    ' j4 Z/ q! p* p# x
systemctl restart containerd;
% s8 z" f) O+ h, r3 @, c; ?
+ R$ h/ c: P4 |% n: \
8 d. M& q0 k, l& `/ g, ?' ~8 F# y0 B
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 00:25 , Processed in 0.018021 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表