|
|
kubectl describe pod -n kube-system kube-flannel-ds-amd64-42rl7! q9 J9 ~' @0 E2 z1 C
/ h: B- o" \/ _5 E/ U
3 a. w+ _' x# r
" Q- p7 ^" {$ V0 M) _0 y$ d, y' [( S, L! }: C, t3 c
Name: kube-flannel-ds-amd64-42rl7Namespace: 8 b0 @; ^3 }+ e, F" a5 K4 {
kube-systemPriority: 0PriorityClassName: <none>+ C' |0 f4 j3 H& p8 P8 ~
Node: node5/10.168.209.17
$ B' ]+ i# i1 u* ]! p/ p8 AStart 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
6 H+ [: a/ H6 g, O' B s2 D d7 w% q3 j- l
检查kube-controller-manager.yaml
/ U* ]7 M& ^; ^: X6 @8 H
- A6 B1 A; g h7 D6 ]7 a1 F+ O5 d' d8 |2 k) j* X( l, `
:apiVersion: v1( |2 N; H, H, u: x( \2 v7 P( Z' x
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: {}4 n) z$ n7 {3 f* z$ T) T
; w4 X! g' d% R5 V# z. d7 P
kubectl logs --namespace kube-system kube-flannel-ds-amd64-5fx2
' |* N) S; O) T" z1 y$ P8 W2 w- y+ c" D$ H" g2 z/ A
) ]# U% o- x% R. Lpmain.go:475] Determining IP address of default interfacemain.go:488] " i8 O- r; } u6 |7 }! }3 Q
% A* h) V5 n4 Q! Z
& d% b9 v5 g* ^) M" rUsing 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...9 X" c, h; c& d. @" c4 k
4 X) K# g; Y4 E+ F2 a4 g
1 H/ u( j- I7 w$ c+ v4 E
- T& z! G$ C( ]" D: _9 x
& t5 C; q1 E% L; K2 Ycat /etc/kubernetes/manifests/kube-controller-manager.yaml | grep -i cluster-cidr- --cluster-cidr=172.168.10.0/244 X x' P, |+ s8 Z$ h& O
/ T) h$ [8 Z; W/ ]) Z G. G: a
: Z+ S# v. A* }# G8 A$ ]9 d6 N0 a+ E9 }$ o7 S3 U
kubectl patch node podname -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'
$ i, K% a. a, b* j5 P$ N, C9 r# Z2 B9 J& }0 p
/ r1 a P3 n* a. V, h0 ]1 x2 q
例如:kubectl patch node slave-node-1 -p '{"spec":{"podCIDR":"172.168.10.0/24"}}'
% j/ t. R# W- x: A5 J; q7 s0 T" b7 b$ k1 P7 F
! s2 Y. T: {* W& Z* G Q
sudo ifconfig cni0 down;1 r# ^1 L) n& p i: s
sudo ifconfig flannel.1 down;% s( L/ ]- J* J- K
sudo ip link delete cni0;
# V: p1 D, @3 ^- i. Msudo 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
, R' f6 U. W; r
kubeadm reset --force;
- Step 1: Down Interface cni0 and flannel.1.
" H0 i, c! T# F+ f8 M* w
sudo ifconfig cni0 down;
& Y; a% r7 i0 f: g8 qsudo ifconfig flannel.1 down;
- Step 2: Delete Interface cni0 and flannel.1.2 }7 I# k4 F8 p$ z8 t2 s1 s
sudo ip link delete cni0; t/ Z& g! E3 c" b2 }
sudo ip link delete flannel.1;
- Step 3: Remove all items within /etc/cni/net.d/.
/ B) b; F ^9 ^
sudo rm -rf /etc/cni/net.d/;
- Step 4: Re-Bootstrap your Kubernetes Cluster again.9 Z1 ^, g( K" M
kubeadm init --control-plane-endpoint="..." --pod-network-cidr=10.244.0.0/16;
- Step 5: Re-deploy CNIs.4 `. X6 R# A- L! F$ @4 J* `
- Step 6: Restart your CNIs, here I used Container Daemon (Containerd).4 k* R+ r' X1 z' j3 b+ q
systemctl restart containerd; 4 g+ K Q4 _; A0 Z3 h4 r; Q: I
+ I. C" E8 r1 H' O5 }) t% a. n6 M( n, r/ W; S
|
|