您现在的位置是:首页 >学无止境 >记录k8s kube-controller-manager-k8s-master kube-scheduler-k8s-master重启网站首页学无止境

记录k8s kube-controller-manager-k8s-master kube-scheduler-k8s-master重启

王Sir_yt 2024-07-01 18:01:02
简介记录k8s kube-controller-manager-k8s-master kube-scheduler-k8s-master重启

1、报错如下

I0529 01:47:12.679312       1 event.go:307] "Event occurred" object="k8s-node-1" fieldPath="" kind="Node" apiVersion="v1" type="Normal" reason="CIDRNotAvailable" message="Node k8s-node-1 status is now: CIDRNotAvailable"
E0529 01:48:44.516760       1 controller_utils.go:262] Error while processing Node Add/Delete: failed to allocate cidr from cluster cidr at idx:0: CIDR allocation failed; there are no remaining CIDRs left to allocate in the accepted range
I0529 01:48:44.516885       1 event.go:307] "Event occurred" object="k8s-master" fieldPath="" kind="Node" apiVersion="v1" type="Normal" reason="CIDRNotAvailable" message="Node k8s-master status is now: CIDRNotAvailable"
E0529 01:49:28.020461       1 controller_utils.go:262] Error while processing Node Add/Delete: failed to allocate cidr from cluster cidr at idx:0: CIDR allocation failed; there are no remaining CIDRs left to allocate in the accepted range
I0529 01:49:28.020839       1 event.go:307] "Event occurred" object="k8s-node-2" fieldPath="" kind="Node" apiVersion="v1" type="Normal" reason="CIDRNotAvailable" message="Node k8s-node-2 status is now: CIDRNotAvailable"

2、可能原因k8s初始化cluster-cidr和service-cluster-ip-range子网划分冲突

(原    --apiserver-advertise-address 10.192.30.20  --service-cidr 10.245.0.0/12    --pod-network-cidr 10.244.0.0/16)

3、修改/etc/kubernetes/manifests/kube-controller-manager.yaml

- --cluster-cidr=10.96.0.0/16                #修改此处

修改后不用重启组件或者集群,稍等后pod自动重建

 kubectl logs  kube-controller-manager-k8s-master  -n kube-system查看没有报错

(未修改之前,即使pod运行正常,查看pod日志还是有上述报错)

4、修改后没有发现问题,请大家在测试环境测试。

风语者!平时喜欢研究各种技术,目前在从事后端开发工作,热爱生活、热爱工作。