易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 2|回复: 0
收起左侧

Kube flannel in CrashLoopBackOff status 解决办法

[复制链接]
发表于 2025-1-2 17:00:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
kubectl describe pod -n kube-system kube-flannel-ds-amd64-42rl7
, h/ p% `+ I- r2 O4 N/ \4 e
' O) L! g2 J8 E" H+ N

0 K( n. Q) X' Y: C: `# n1 S2 V* s$ g# b5 l8 b7 }+ p  I! m% j
" B  p( \; _1 X$ L% M
Name:               kube-flannel-ds-amd64-42rl7Namespace:         % L! E+ u0 S' x! _
kube-systemPriority:           0PriorityClassName:  <none>
: G. I) ^( y% M0 }Node:               node5/10.168.209.17
. T! n' R1 z' V& I9 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. B/ V& @: u. J! u
/ S; E5 S% g2 b& [! A! ~6 ?
检查kube-controller-manager.yaml
5 R8 |, ]3 w' j" Q- t2 |# {2 Q- d

4 [$ ^, C+ R+ E# m4 i1 i: y4 S

/ ?% _2 G) a$ X( m$ O1 F:apiVersion: v1
) V: Q8 ^2 d% K' L* \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: {}- k: ~- C8 V6 g; u. U# \- O- E

: V6 h9 S# d/ i8 D/ o  S& v1 G" X0 s2 Ckubectl logs --namespace kube-system kube-flannel-ds-amd64-5fx2
/ T/ Y& q/ R8 z4 L
) x5 H2 S+ s' b& F
7 L9 E, D' N3 Y8 m$ r* a
pmain.go:475] Determining IP address of default interfacemain.go:488] 8 C% w! P8 U* K+ p( @2 M

2 N  A4 l3 J; }' i( `8 \

0 b- H: ]; \) g2 d+ j" hUsing 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 m  R# Z5 B' I5 F' M
: p: E$ g$ i; y6 h

; k9 J, `2 y7 `7 l$ j: Y+ a) A9 a, q3 n
; u8 l& j9 W9 x- O2 @
cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep -i cluster-cidr- --cluster-cidr=172.168.10.0/24
  h# q6 Z0 ?# P. Q# F
* A% e' N6 Z, }3 Q. z% E" h! P

* J. }3 q1 l/ V0 z0 {! c& F, k* H/ v" x8 }6 m2 @
kubectl patch node podname -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'

9 C' A" Q8 t1 a1 p# |) I9 R, C; w# _2 N7 W; }6 U$ @
4 R6 W) f7 N- ?+ R' D4 L6 p
例如:kubectl patch node slave-node-1 -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'/ M! E* M7 t  \- d, i
4 b  Z. n  n, L. N9 y/ W: {
3 O# W& U& i5 Q/ z  {4 ?
sudo ifconfig cni0 down;, s' X2 x+ Q  U. }. {
sudo ifconfig flannel.1 down;
3 X5 V2 r7 m' k0 t
sudo ip link delete cni0;6 f) n2 ?' \! f# ~, p* T
sudo ip link delete flannel.1;
To fix this, please following the step below:
  • Step 0: Reset all Nodes within your Cluster. Run all nodes with6 z; q7 }0 }  U/ q
kubeadm reset --force;
  • Step 1: Down Interface cni0 and flannel.1." L. Y% e, k* ^
sudo ifconfig cni0 down;
7 h7 z% F; W( i0 a+ Y+ W* C3 W9 @sudo ifconfig flannel.1 down;
  • Step 2: Delete Interface cni0 and flannel.1.
    7 H1 N# {. v9 R6 Y- X- {& E, Q
sudo ip link delete cni0;
/ U& c0 h2 ]+ g2 P, ~- p) csudo ip link delete flannel.1;
  • Step 3: Remove all items within /etc/cni/net.d/.
    0 ]. w0 [/ C, l. b9 {# l+ b
sudo rm -rf /etc/cni/net.d/;
  • Step 4: Re-Bootstrap your Kubernetes Cluster again.& Y8 w8 e& g" T' L% T
kubeadm init --control-plane-endpoint="..." --pod-network-cidr=10.244.0.0/16;
  • Step 5: Re-deploy CNIs.! Y* T7 T) c* E! K
  • Step 6: Restart your CNIs, here I used Container Daemon (Containerd).3 w) ~! ]) k; P% j! A5 D, Q
systemctl restart containerd;

3 g) L& }% s2 \3 Y0 K6 I

5 q8 `& o( ^9 `0 Z; M
! h0 o" C- |2 p$ l( l/ k
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:27 , Processed in 0.042979 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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