Kubernetes 仪表板不显示 CPU 和内存使用情况

k_g*_*905 1 metrics dashboard kubernetes

我的 Kubernetes 仪表板有问题。我实际上使用托管 Kubernetes 服务 AKS 并使用以下设置创建了 Kubernetes 集群:

  • Kubernetes-版本 1.20.9
  • 1 个大小为 Standard_DS2_v2 的工作节点

它通过自动配置corednscorednsautoscaleromsagent-rstunnelfrontmetrics-sever成功启动。

之后,我为我的服务应用了三个部署,全部部署成功。

现在,我想访问 Kubernetes 仪表板。我使用了https://artifacthub.io/packages/helm/k8s-dashboard/kubernetes-dashboard上描述的指令。

之后,我调用kubectl proxy通过以下网址访问仪表板:http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/。

在我使用 kubeconfig 文件登录 Kubernetes 仪表板后,我得到以下输出,并且 cpu 也没有显示内存使用情况。

在此输入图像描述

当我执行 kubectl 描述 kubernetes-dashboard pod 时,我得到以下信息: 在此输入图像描述

pod 中的日志如下所示:

Internal error occurred: No metric client provided. Skipping metrics.
2021/12/11 19:23:04 [2021-12-11T19:23:04Z] Outcoming response to 127.0.0.1:43392 with 200 status code
2021/12/11 19:23:04 Internal error occurred: No metric client provided. Skipping metrics.
2021/12/11 19:23:04 [2021-12-11T19:23:04Z] Outcoming response to 127.0.0.1:43392 with 200 status code
2021/12/11 19:23:04 Internal error occurred: No metric client provided. Skipping metrics.
Run Code Online (Sandbox Code Playgroud)

goh*_*m'c 7

... I used the instruction which is described on https://artifacthub.io/packages/helm/k8s-dashboard/kubernetes-dashboard.

The dashboard needs a way to "cache" a small window of metrics collected from the metrics server. The instruction provided there doesn't have this enabled. You can run the following to install/upgrade kubernetes-dashboard with metrics scraper enabled:

helm upgrade -i kubernetes-dashboard/kubernetes-dashboard --name my-release \  
--set=service.externalPort=8080,resources.limits.cpu=200m,metricsScraper.enabled=true
Run Code Online (Sandbox Code Playgroud)