|
|
kubectl describe pod -n kube-system kube-flannel-ds-amd64-42rl7 K" Y% [# N( w3 p" m
' |2 W7 W8 e% {
8 @7 A4 P0 p1 j
% L) ]- Q% m% R6 Y
, G7 T0 @0 |! n0 GName: kube-flannel-ds-amd64-42rl7Namespace: 4 W- `* M5 q) `
kube-systemPriority: 0PriorityClassName: <none>+ ^. _. U. F4 g3 g5 S
Node: node5/10.168.209.17
3 M3 u& S8 N, c4 a. ^2 ?& t( A0 }Start 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 container0 Y+ C- |6 j) S! g
& ~8 I5 P7 j" f9 b" D- F- v检查kube-controller-manager.yaml: L1 L5 N8 e, ]2 @7 ]
' W' ^1 x, N& ]+ E. z- R ^
' U1 n% G# o2 M# L# k:apiVersion: v1
4 e8 S' \) j6 {% n" o2 s G3 K+ Akind: 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: {}2 a$ P" j" m0 `0 {! x8 Q: W
( t/ z- {. J y* f/ E- f1 s
kubectl logs --namespace kube-system kube-flannel-ds-amd64-5fx2
, \) l) G; E/ q5 T* K, u. x; F0 M
; c4 T5 C( [! o
pmain.go:475] Determining IP address of default interfacemain.go:488] 7 D7 a. V; C/ V3 \+ l0 M& o
. i7 a: O% D4 O! f' M0 V2 A4 Y
6 s( c) l$ g! f0 {. }
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...
1 b; E, h( i( ?& U. M! g4 N
/ D. B+ e3 c/ f: Y% [. l4 u( }% ]* u4 o! _5 }' Y0 z* b9 B3 w
& G0 Z' `+ N# Y( ~! u0 z$ D" g; R6 x' C' H4 @
cat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep -i cluster-cidr- --cluster-cidr=172.168.10.0/24. m% ?6 u& {/ Q) [9 o t
5 u1 ~ N$ e; S+ `2 G9 r
7 \8 z% z, b8 d# \" \# [
! V. P Y8 O, {- Ukubectl patch node podname -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'
5 E4 ~' Z) }. L, K% K2 ^: N4 {4 p! ?- ^5 m8 X) O9 K$ C
& a9 w: P7 ]% l8 S& I. d* S5 o# ^例如:kubectl patch node slave-node-1 -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'( @; }8 m* Z# m/ H- U( {) A
% k. s9 r7 `( `' l& |
8 |- P T! e% d# x) L/ h& H
sudo ifconfig cni0 down;7 L4 C( }! u; ]% X8 T
sudo ifconfig flannel.1 down;
C) U0 i9 n7 H' D2 W/ E+ h8 z! csudo ip link delete cni0;
# Q- G4 o, C! Bsudo 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$ O* e+ d& U$ W& [
kubeadm reset --force;
- Step 1: Down Interface cni0 and flannel.1.& p/ O# n7 T l: |
sudo ifconfig cni0 down;
9 N: P5 [! s2 W! Dsudo ifconfig flannel.1 down;
- Step 2: Delete Interface cni0 and flannel.1.
# l6 _# h! l4 \- q- g6 ]9 w, G
sudo ip link delete cni0;
0 O' g* p% N2 I6 A) M6 h y6 C8 X% usudo ip link delete flannel.1;
- Step 3: Remove all items within /etc/cni/net.d/.5 j( J, p+ v- ]: C* o% b) D
sudo rm -rf /etc/cni/net.d/;
- Step 4: Re-Bootstrap your Kubernetes Cluster again.
& `' T! ]' h. K& A' a
kubeadm init --control-plane-endpoint="..." --pod-network-cidr=10.244.0.0/16;
- Step 5: Re-deploy CNIs.& \$ w% D. ]2 G( U1 ^
- Step 6: Restart your CNIs, here I used Container Daemon (Containerd).4 d2 y2 ~$ j, C1 q
systemctl restart containerd;
9 i6 r7 g1 V2 `5 A - M* _2 y) ?" B+ P4 w2 n% `
O: p+ j( p* k |
|