Kubernetes仪表板不显示Pod消耗的CPU和内存

时间:2018-12-13 12:39:30

标签: kubernetes kubeadm kubernetes-dashboard

我已成功连接到 Kubernetes仪表板,并且可以看到我所有的deploymentstatefulsetspods等。但是确定了Pod使用的CPU和内存量不存在。

所有豆荚:

kube-system   coredns-576cbf47c7-cj8qv                1/1     Running   33         67d
kube-system   coredns-576cbf47c7-qh9hm                1/1     Running   34         67d
kube-system   etcd-master                             1/1     Running   15         67d
kube-system   heapster-684777c4cb-qt6f5               1/1     Running   0          134m
kube-system   kube-apiserver-master                   1/1     Running   23         67d
kube-system   kube-controller-manager-master          1/1     Running   15         67d
kube-system   kube-proxy-bs5k9                        1/1     Running   13         67d
kube-system   kube-proxy-fjp8b                        1/1     Running   13         67d
kube-system   kube-scheduler-master                   1/1     Running   15         67d
kube-system   kubernetes-dashboard-77fd78f978-cnhsc   1/1     Running   0          71m
kube-system   metrics-server-5cbbc84f8c-vz77c         1/1     Running   0          71m
kube-system   monitoring-influxdb-5c5bf4949d-jqr9d    1/1     Running   0          133m
kube-system   weave-net-fl972                         2/2     Running   77         67d
kube-system   weave-net-gh96b                         2/2     Running   34         67d

仪表板窗格中有日志:

2018/12/16 08:43:54 Starting overwatch
2018/12/16 08:43:54 Using in-cluster config to connect to apiserver
2018/12/16 08:43:54 Using service account token for csrf signing
2018/12/16 08:43:54 No request provided. Skipping authorization
2018/12/16 08:43:54 Successful initial request to the apiserver, version: v1.12.1
2018/12/16 08:43:54 Generating JWE encryption key
2018/12/16 08:43:54 New synchronizer has been registered: kubernetes-dashboard-key-holder-kube-system. Starting
2018/12/16 08:43:54 Starting secret synchronizer for kubernetes-dashboard-key-holder in namespace kube-system
2018/12/16 08:43:55 Initializing JWE encryption key from synchronized object
2018/12/16 08:43:55 Creating in-cluster Heapster client
2018/12/16 08:43:55 Successful request to heapster
2018/12/16 08:43:55 Auto-generating certificates
2018/12/16 08:43:55 Successfully created certificates
2018/12/16 08:43:55 Serving securely on HTTPS port: 8443
2018/12/16 08:44:19 Getting application global configuration
2018/12/16 08:44:19 Application configuration {"serverTime":1544949859551}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/settings/global request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/login/status request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/systembanner request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/login/status request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/rbac/status request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/csrftoken/token request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 POST /api/v1/token/refresh request from 10.32.0.1:53200: { contents hidden }
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Incoming HTTP/2.0 GET /api/v1/overview/default?filterBy=&itemsPerPage=10&name=&page=1&sortBy=d,creationTimestamp request from 10.32.0.1:53200: {}
2018/12/16 08:44:20 Getting config category
2018/12/16 08:44:20 Getting discovery and load balancing category
2018/12/16 08:44:20 Getting lists of all workloads
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 No metric client provided. Skipping metrics.
2018/12/16 08:44:20 Getting pod metrics
2018/12/16 08:44:20 [2018-12-16T08:44:20Z] Outcoming response to 10.32.0.1:53200 with 200 status code
2018/12/16 08:44:24 Getting application global configuration
2018/12/16 08:44:24 Application configuration {"serverTime":1544949864040}

哪个说:

Creating in-cluster Heapster client
Successful request to heapster

因此,堆程序已正确连接到kubernetes仪表板。 我使用kubeadm version=v1.12.1

当我在主节点上执行kubectl top node来获取CPU和内存使用情况时,它也会显示所使用的CPU和内存量。 当我想通过诸如teminal的方式访问堆积器时:

curl -L http://heapster-pod-ip:heapster-service-port/api/v1/model/metrics/

它返回:

curl: (7) Failed to connect to 10.40.0.63 port 80: Connection refused

度量服务窗格的日志:

I1216 12:05:24.783577       1 serving.go:273] Generated self-signed cert (apiserver.local.config/certificates/apiserver.crt, apiserver.local.config/certificates/apiserver.key)
[restful] 2018/12/16 12:05:25 log.go:33: [restful/swagger] listing is available at https://:443/swaggerapi
[restful] 2018/12/16 12:05:25 log.go:33: [restful/swagger] https://:443/swaggerui/ is mapped to folder /swagger-ui/
I1216 12:05:25.802972       1 serve.go:96] Serving securely on [::]:44

3

有什么主意吗?

3 个答案:

答案 0 :(得分:1)

Heapster已淘汰,您可能需要按照here的步骤修改heapster的安装。

答案 1 :(得分:0)

来自Kubernetes信息中心README.MD的报价:

  

Heapster必须在集群中运行以获取指标和图形   可用。在集成指南中了解有关此内容的更多信息。

要查看图形,您需要部署 grafana.yaml heapster.yaml influxdb.yamlheapster-rbac.yaml

然后运行

kubectl delete -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

您将能够看到Pod和部署的图形。

我希望它会有用

答案 2 :(得分:0)

这是一个悬而未决的问题,目前为止尚未解决。 https://github.com/kubernetes/dashboard/issues/4145

  

我们知道,我们在衡量指标方面存在一些问题   已修复。我们将对其进行处理。