Troubleshoot: Kubernetes Dashboard not Showing Metrics

When kubernetes dashboard doesnt show metrics like it should, you can do the following:

1. Create heapster replication controller:
apiVersion: v1  
kind: ReplicationController  
metadata:  
  labels:
    k8s-app: heapster
    name: heapster
    version: v6
  name: heapster
  namespace: kube-system
spec:  
  replicas: 1
  selector:
    k8s-app: heapster
    version: v6
  template:
    metadata:
      labels:
        k8s-app: heapster
        version: v6
    spec:
      containers:
      - name: heapster
        image: kubernetes/heapster:canary
        imagePullPolicy: Always
        command:
        - /heapster
        - --source=kubernetes:https://10.2.0.1:443
        volumeMounts:
        - name: ssl-certs
          mountPath: /etc/ssl/certs
          readOnly: true
      volumes:
      - name: ssl-certs
        hostPath:
          path: /etc/ssl/certs
2. Create heapster service.
apiVersion: v1  
kind: Service  
metadata:  
  labels:
    kubernetes.io/cluster-service: 'true'
    kubernetes.io/name: Heapster
  name: heapster
  namespace: kube-system
spec:  
  ports:
  - port: 80
    targetPort: 8082
  selector:
    k8s-app: heapster
apiVersion: v1  
kind: Service  
metadata:  
  labels:
    kubernetes.io/cluster-service: 'true'
    kubernetes.io/name: Heapster
  name: heapster-nodeport
  namespace: kube-system
spec:  
  ports:
  - port: 80
    targetPort: 8082
    nodePort: 30082
  type: NodePort
  selector:
    k8s-app: heapster
3. check heapster log
root@ip-172-20-46-246:/home/admin# kl2 heapster-1rhvi  
I0201 08:45:35.368011       1 heapster.go:71] /heapster --source=kubernetes:https://100.64.0.1:443  
I0201 08:45:35.368063       1 heapster.go:72] Heapster version v1.3.0-beta.0  
I0201 08:45:35.368367       1 configs.go:60] Using Kubernetes client with master "https://100.64.0.1:443" and version v1  
I0201 08:45:35.368379       1 configs.go:61] Using kubelet port 10255  
I0201 08:45:35.399405       1 heapster.go:193] Starting with Metric Sink  
I0201 08:45:35.417143       1 heapster.go:105] Starting heapster on port 8082  
4. check kubernetes dashboard log
Using HTTP port: 9090  
Creating API server client for https://100.64.0.1:443  
Successful initial request to the apiserver, version: v1.4.7  
Creating in-cluster Heapster client  
Using service account token for csrf signing  
Getting application global configuration  
Application configuration {"serverTime":1485939208903}  
[2017-02-01T08:53:34Z] Incoming HTTP/1.1 GET /api/v1/node?itemsPerPage=10&namespace=&page=1 request from 172.20.46.246:38742
Getting list of all nodes in the cluster  
5. test heapster api endpoints.
curl 100.64.98.240/api/v1/model/nodes  

Lukman

Radio astronomer pretending to be system engineer.

Bandung, Indonesia