问题:在kubernetes service-cluster-ip-range地址网段明明配置的地址段10.10.10.0/24,但是Cluster Service IP居然使用是192.168.0.1。

kubernetes cluster IP not with in the service CIDR Cloud 第1张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

分析:

查看k8s中apiserver服务日志:
tail -f /data/logs/kubernetes/kube-apiserver/apiserver.stdout.log

the cluster IP 192.168.0.1 for service kubernetes/default is not within the service CIDR x.x.x.x/24; please recreate

kubernetes cluster IP not with in the service CIDR Cloud 第2张

查看service信息:
kubectl describe service kubernetes

Warning Cluster IP Out Of Range 5m16s (x292 over 14h) ipallocator-repair-controller Cluster IP 192.168.0.1 is not with in the service CIDR 10.10.10.0/24; please recreate service

kubernetes cluster IP not with in the service CIDR Cloud 第3张

#https://www.cnblogs.com/liucx/

解决问题:
使用命令:kubectl delete service kubernetes,然后系统会自动用新的ip重建这个service,就能解决

kubernetes cluster IP not with in the service CIDR Cloud 第4张

删除ipvsadm规则 :

         ipvsadm -D -t  192.168.0.1:443

kubernetes cluster IP not with in the service CIDR Cloud 第5张

 原因:经过回忆是因为中途修改过--service-cluster-ip-range地址,一开始以为是 apiserver-csr.json中签证hosts中IP顺序的问题,其实并不是,但是hosts必须要有service-cluster-ip-range网段中的第一个IP。后面重新deletet就解决了

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄