k8s二进制部署系列10-检查k8s集群状态

2018年7月16日13:43:18k8s二进制部署系列10-检查k8s集群状态已关闭评论 1,567 views

1.1 检查master服务状态

1
2
3
4
[root@k8s-master ~]# systemctl status kube-apiserver.service kube-controller-manager.service kube-scheduler.service  | grep active
   Active: active (running) since Thu 2018-07-12 23:25:50 CST; 1 day 11h ago
   Active: active (running) since Thu 2018-07-12 23:25:42 CST; 1 day 11h ago
   Active: active (running) since Thu 2018-07-12 23:25:42 CST; 1 day 11h ago

1.2 检查node服务状态

1
2
3
[root@k8s-node01 ~]# systemctl status kubelet.service kube-proxy.service | grep active
   Active: active (running) since Thu 2018-07-12 23:27:07 CST; 1 day 11h ago
   Active: active (running) since Thu 2018-07-12 23:27:07 CST; 1 day 11h ago

1.3 检查节点状态

1
2
3
4
[root@k8s-master ~]# kubectl get nodes
NAME         STATUS    ROLES     AGE       VERSION
k8s-node01   Ready     <none>    1d        v1.10.4
k8s-node02   Ready     <none>    1d        v1.10.4

1.4 检查集群状态

提示:由于controller-manager关闭了http访问端口,故此处显示Unhealthy状态,不影响正常使用。
1
2
3
4
5
6
7
[root@k8s-master ~]# kubectl get cs
NAME                 STATUS      MESSAGE                                                                                                                                  ERROR
controller-manager   Unhealthy   Get http://127.0.0.1:10252/healthz: net/http: HTTP/1.x transport connection broken: malformed HTTP response "\x15\x03\x01\x00\x02\x02"
scheduler            Healthy     ok
etcd-2               Healthy     {"health":"true"}
etcd-1               Healthy     {"health":"true"}
etcd-0               Healthy     {"health":"true"}
  • 说明:
  • 执行kubectl get componentstatuses 命令时,apiserver 默认向0.0.1 发送请求。当 controller-manager、scheduler 以集群模式运行时,有可能和 kube-apiserver 不在一台机器上,这时 controller-manager 或 scheduler 的状态为 Unhealthy,但实际上它们工作正常
weinxin
我的微信
如果有技术上的问题可以扫一扫我的微信