I built a cluster of kubernetes and installed kubernetes-dashboard and metrics-server, but metric information for the metrics-server (CPU and memory) is not displayed on kubernetes-dashboard.
I installed kubernetes-dashboard using kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v1.10.1/src/deploy/recommended/kubernetes-dashboard.yaml
.
I installed metrics-server using git clone https://github.com/kubernetes-incubator/metrics-server.git
and using kubectl apply -f 1.8+/
.
I modified the configuration of the deploy/1.8+/metrics-server-deployment.yaml file.
containers:
- name: metrics-server
image: registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3
imagePullPolicy: IfNotPresent
command:
- /metrics-server
- --kubelet-preferred-address-types=InternalIP
- --kubelet-insecure-tls
Coupe of things here. Since you are deploying v1.10.1
of Dashboard you have to have Kubernetes 1.10 or older (described in release notes), and Heapster deployed in your cluster (described here):
Heapster has to be running in the cluster for the metrics and graphs to be available. Read more about it in Integrations guide.
metrics-server
deployment needs to have args:
instead of command:
in the deployment, as described here.
Like so:
containers:
- name: metrics-server
image: registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-server-amd64:v0.3.3
imagePullPolicy: IfNotPresent
args:
- /metrics-server
- --kubelet-preferred-address-types=InternalIP
- --kubelet-insecure-tls
If you are using Kubernetes newer than 1.10 you can go with Dashboard v2.0.0-beta1 for k8s 1.14, or v2.0.0-beta2 for k8s 1.15. Then you don`t need Heapster, since the betas added support for gathering metrics from metrics-server directly. More details in release notes.
Hope this helps!