查看cs状态:发现是有问题的
代码语言:javascript复制[root@master1 ~]#kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19
NAME STATUS MESSAGE ERROR
controller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refused
scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused
etcd-0 Healthy {"health":"true"}
解决思路: 注释掉/etc/kubernetes/manifests下的kube-controller-manager.yaml和kube-scheduler.yaml的- – port=0 确认kube-scheduler和kube-controller-manager组件配置是否禁用了非安全端口
代码语言:javascript复制[root@master1 ~]#cd /etc/kubernetes/manifests
[root@master1 /etc/kubernetes/manifests]#ls
etcd.yaml kube-apiserver.yaml kube-controller-manager.yaml kube-scheduler.yaml
#搜索- – port=0更改为:#- – port=0
[root@master1 /etc/kubernetes/manifests]#vim kube-controller-manager.yaml
[root@master1 /etc/kubernetes/manifests]#vim kube-scheduler.yaml
重启kubelet:
代码语言:javascript复制sudo systemctl restart kubelet
查看端口是否开启:10251和10252
代码语言:javascript复制[root@k8s-master ~]# netstat -tunlp | grep 10251
tcp6 0 0 :::10251 :::* LISTEN 16049/kube-schedule
[root@k8s-master ~]# netstat -tunlp | grep 10252
tcp6 0 0 :::10252 :::* LISTEN 16050/kube-controll
重启服务之后确认组件状态,显示就正常了
代码语言:javascript复制[root@master1 /etc/kubernetes/manifests]#kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true"}