1、:Error registering network: failed to acquire lease: node "test4" pod cidr not assigned

执行kubectl create kube-flannel.yml 创建后,发现flannel刚开始running了几秒,然后就处于Error状态

先查看pod

[root@test4 profile]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
kube-flannel-ds-gzvrh 0/1 Error 0 <invalid> 再通过docker查看flannel日志 [root@test4 profile]# docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f7be3ebe77fd b949a39093d6 "/opt/bin/flanneld -…" 1 second ago Created k8s_kube-flannel_kube-flannel-ds-7cqww_kube-system_26fab004-2b88-11e9-9085-000c2935f634_0 [root@test4 profile]# docker logs f7be3ebe77fd
I0208 09:58:34.068723 1 main.go:488] Using interface with name ens33 and address 192.168.0.94
I0208 09:58:34.069094 1 main.go:505] Defaulting external address to interface address (192.168.0.94)
I0208 09:58:34.376952 1 kube.go:131] Waiting 10m0s for node controller to sync
I0208 09:58:34.466001 1 kube.go:294] Starting kube subnet manager
I0208 09:58:35.481478 1 kube.go:138] Node controller sync successful
I0208 09:58:35.481666 1 main.go:235] Created subnet manager: Kubernetes Subnet Manager - test4
I0208 09:58:35.481694 1 main.go:238] Installing signal handlers
I0208 09:58:35.482001 1 main.go:353] Found network config - Backend type: vxlan
I0208 09:58:35.482255 1 vxlan.go:120] VXLAN config: VNI=1 Port=0 GBP=false DirectRouting=false
E0208 09:58:35.483159 1 main.go:280] Error registering network: failed to acquire lease: node "test4" pod cidr not assigned
I0208 09:58:35.483433 1 main.go:333] Stopping shutdownHandler... 看到:Error registering network: failed to acquire lease: node "test4" pod cidr not assigned 原因:是因为按照二进制高可用文档安装配置kube-controller-manager启动文件的时候,有坑,当时没有发现, 解决: 启动文件加上下面两句话,那篇文档没有加,所以报错;下面这个cluster-cidr要和kube-flannel.yml里面的地址一致,要和kube-proxy.config.yaml里面的clusterCIDR一致 --allocate-node-cidrs=true \
--cluster-cidr=172.30.0.0/16 \ 2、报错2 : 创建flnal 后 一会runing 一会挂掉 解决: 安装kube-kube-proxy ,不要选择ipvs模式,centos7环境,ipvs模式在1.11.0不行, 在1.11.1之后就ok了

参照文档: https://www.cnblogs.com/iiiiher/p/8159693.html
05-27 02:00