我尝试为ver1.12_rc.1部署k8s环境。
它包括一个主节点和两个节点。它们都是CentOS Linux版本7.4.1708(核心)。相关信息如下:

[root@bogon174 dashboard]# kubectl get pods -n kube-system
NAME                                     READY   STATUS    RESTARTS   AGE
heapster-684777c4cb-fm6kd                1/1     Running   0          32m
kubernetes-dashboard-77fd78f978-khc4f    1/1     Running   0          32m
metrics-server-v0.3.1-6879897646-c7rwz   2/2     Running   0          37m
monitoring-grafana-56b668bccf-29277      1/1     Running   0          32m
monitoring-influxdb-5c5bf4949d-l8ttc     1/1     Running   0          32m

[root@bogon174 dashboard]# kubectl get services -n kube-system
NAME                   TYPE        CLUSTER-IP        EXTERNAL-IP   PORT(S)         AGE
heapster               ClusterIP   169.169.120.140   <none>        80/TCP          33m
kubernetes-dashboard   NodePort    169.169.151.109   <none>        443:26007/TCP   33m
metrics-server         NodePort    169.169.218.252   <none>        443:10521/TCP   38m
monitoring-grafana     ClusterIP   169.169.170.53    <none>        80/TCP          33m
monitoring-influxdb    ClusterIP   169.169.248.0     <none>        8086/TCP        33m

[root@bogon174 dashboard]# kubectl get nodes
NAME             STATUS     ROLES    AGE   VERSION
192.168.20.171   Ready      <none>   10d   v1.12.0-rc.1
192.168.20.172   NotReady   <none>   10d   v1.12.0-rc.1

我研究了先前的问题,但无法获得正确的解决方案。

最佳答案

版本1.12不再使用heapster,并且top命令尚未移植到新的指标系统。有一个github问题,以便顶部可以使用新的指标系统。

查看可用的选项,唯一的一个是heapster,但是不再使用heapster。

[iahmad@web-prod-ijaz001 ~]$ kubectl top node --help
Display Resource (CPU/Memory/Storage) usage of nodes.

The top-node command allows you to see the resource consumption of nodes.

Aliases:
node, nodes, no

Examples:
  # Show metrics for all nodes
  kubectl top node

  # Show metrics for a given node
  kubectl top node NODE_NAME

Options:
      --heapster-namespace='kube-system': Namespace Heapster service is located in
      --heapster-port='': Port name in service to use
      --heapster-scheme='http': Scheme (http or https) to connect to Heapster as
      --heapster-service='heapster': Name of Heapster service
  -l, --selector='': Selector (label query) to filter on, supports '=', '==', and '!='.(e.g. -l key1=value1,key2=value2)

Usage:
  kubectl top node [NAME | -l label] [options]

关于kubernetes - kubectl顶部节点无法工作,它显示: “error: You must be logged in to the server (Unauthorized)”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53001206/

10-16 23:50