学无先后,达者为师

网站首页 编程语言 正文

Kubeadm:如何解决kubectl get cs显示scheduler Unhealthy,controller-manager Unhealthy

作者:Kevin古月 更新时间: 2022-04-01 编程语言

报错显示

[root@k8s-master ~]# kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME                 STATUS      MESSAGE                                                    OR
scheduler            Unhealthy   Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10
controller-manager   Unhealthy   Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10
etcd-0               Healthy     {"health":"true"} 

排障思路

1.查看端口

首先确认没有启动10251、10252端口

[root@k8s-master ~]# netstat -ntlup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program 
tcp        0      0 127.0.0.1:10248         0.0.0.0:*               LISTEN      72329/kubele
tcp        0      0 127.0.0.1:10249         0.0.0.0:*               LISTEN      72826/kube-p
tcp        0      0 127.0.0.1:9099          0.0.0.0:*               LISTEN      91238/calico
tcp        0      0 20.0.0.56:2379          0.0.0.0:*               LISTEN      71856/etcd  
tcp        0      0 127.0.0.1:2379          0.0.0.0:*               LISTEN      71856/etcd  
tcp        0      0 20.0.0.56:2380          0.0.0.0:*               LISTEN      71856/etcd  
tcp        0      0 127.0.0.1:2381          0.0.0.0:*               LISTEN      71856/etcd  
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd   
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      9519/X      
tcp        0      0 127.0.0.1:10257         0.0.0.0:*               LISTEN      34287/kube-c
tcp        0      0 127.0.0.1:10259         0.0.0.0:*               LISTEN      34472/kube-s
tcp        0      0 0.0.0.0:179             0.0.0.0:*               LISTEN      112065/bird 
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      9978/dnsmasq
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      9418/sshd   
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      9415/cupsd  
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      9687/master 
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      91446/sshd: 
tcp        0      0 127.0.0.1:39451         0.0.0.0:*               LISTEN      72329/kubele
tcp6       0      0 :::10250                :::*                    LISTEN      72329/kubele
tcp6       0      0 :::6443                 :::*                    LISTEN      88744/kube-a
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd   
tcp6       0      0 :::10256                :::*                    LISTEN      72826/kube-p
tcp6       0      0 :::6000                 :::*                    LISTEN      9519/X      
tcp6       0      0 :::22                   :::*                    LISTEN      9418/sshd   
tcp6       0      0 ::1:631                 :::*                    LISTEN      9415/cupsd  
tcp6       0      0 ::1:25                  :::*                    LISTEN      9687/master 
tcp6       0      0 ::1:6010                :::*                    LISTEN      91446/sshd: 
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           8687/avahi-d
udp        0      0 192.168.122.1:53        0.0.0.0:*                           9978/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           9978/dnsmasq
udp        0      0 0.0.0.0:111             0.0.0.0:*                           1/systemd   
udp        0      0 127.0.0.1:323           0.0.0.0:*                           8653/chronyd
udp        0      0 0.0.0.0:53873           0.0.0.0:*                           8687/avahi-d
udp        0      0 0.0.0.0:747             0.0.0.0:*                           8631/rpcbind
udp6       0      0 :::111                  :::*                                1/systemd   
udp6       0      0 ::1:323                 :::*                                8653/chronyd
udp6       0      0 :::747                  :::* 

2.确认schedule和controller-manager组件配置是否禁用了非安全端口

配置文件路径为:/etc/kubernetes/manifests/kube-scheduler.yaml和/etc/kubernetes/manifests/kube-controller-manager.yaml
将两个配置文件中–port注释掉
在这里插入图片描述
最后重启kubelet服务就可以了,再次查看

[root@k8s-master manifests]# kubectl get cs
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME                 STATUS    MESSAGE             ERROR
controller-manager   Healthy   ok                  
scheduler            Healthy   ok                  
etcd-0               Healthy   {"health":"true"} 


原文链接:https://blog.csdn.net/m0_47219942/article/details/115231303

栏目分类
最近更新