[k8s]dashboard1.8.1搭建( heapster1.5+influxdb+grafana)


dashboard最終效果

多了執行sh的窗口

heapster+influxdb+grafana搭建

整個架構是 dashboard去檢測 hepster service服務, heapster通過cadvisor搜集到數據入庫到influxdb. 而dashboard訪問heapster的svc的8086端口獲取數據繪圖.

准備yaml

https://github.com/kubernetes/heapster/blob/master/deploy/kube-config/influxdb

[root@n1 influxdb]# tree .
.
├── grafana.yaml
├── heapster.yaml
└── influxdb.yaml

修改鏡像並創建

[root@n1 influxdb]# grep -r image: .
./influxdb.yaml:        image: lanny/k8s.gcr.io_heapster-influxdb-amd64:v1.3.3
./grafana.yaml:        image: lanny/k8s.gcr.io_heapster-grafana-amd64:v4.4.3 
./heapster.yaml:        image: lanny/gcr.io_google_containers_heapster-amd64:v1.5.0

注: 這里用v1.5.0的heapster.看release用最新的,官方的yaml可能還是舊的

dashboard1.8.1

部署dashboard 1.8.1

https://github.com/kubernetes/dashboard/releases

dashboard.yaml

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kubernetes-dashboard
  template:
    metadata:
      labels:
        app: kubernetes-dashboard
      # Comment the following annotation if Dashboard must not be deployed on master
      annotations:
        scheduler.alpha.kubernetes.io/tolerations: |
          [
            {
              "key": "dedicated",
              "operator": "Equal",
              "value": "master",
              "effect": "NoSchedule"
            }
          ]
    spec:
      containers:
      - name: kubernetes-dashboard
        image: lanny/gcr.io_google_containers_kubernetes-dashboard-amd64:v1.8.1 
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 9090
          protocol: TCP
        args:
          # Uncomment the following line to manually specify Kubernetes API server Host
          # If not specified, Dashboard will attempt to auto discover the API server and connect
          # to it. Uncomment only if the default does not work.
          # - --apiserver-host=http://my-address:port
           - --apiserver-host=http://192.168.x.x:8080
           - --heapster-host=http://heapster  #要有這玩意,不然創建后可能heapster檢查失敗,導致ui不顯示圖形.
        livenessProbe:
          httpGet:
            path: /
            port: 9090
          initialDelaySeconds: 30
          timeoutSeconds: 30
---
kind: Service
apiVersion: v1
metadata:
  labels:
    app: kubernetes-dashboard
  name: kubernetes-dashboard
  namespace: kube-system
spec:
  type: NodePort
  ports:
  - port: 80
    targetPort: 9090
  selector:
    app: kubernetes-dashboard

出現的問題

ui圖形不展示

dashboard的日志: dashboard會去連heapster的8082端口獲取數據來展示圖形. 這里看到heapster連不上,但是heapster的日志沒問題

2018/01/02 04:14:29 Metric client health check failed: an error on the server ("Error: 'dial tcp 10.244.1.43:8082: getsockopt: connection refused'\nTrying to reach: 'http://10.244.1.43:8082/healthz'") has prevented the request from succeeding (get services heapster). Retrying in 30 seconds.
2018/01/02 04:15:20 Metric client health check failed: an error on the server ("Error: 'dial tcp 10.244.1.43:8082: getsockopt: connection refused'\nTrying to reach: 'http://10.244.1.43:8082/healthz'") has prevented the request from succeeding (get services heapster). Retrying in 30 seconds.
2018/01/02 04:16:11 Metric client health check failed: an error on the server ("Error: 'dial tcp 10.244.1.43:8082: getsockopt: connection refused'\nTrying to reach: 'http://10.244.1.43:8082/healthz'") has prevented the request from succeeding (get services heapster). Retrying in 30 seconds.

解決: dashboard的yaml加- --heapster-host=http://heapster 參數即可
參考: https://github.com/kubernetes/dashboard/issues/1602

創建dashboard后,訪問不出現ui

我用參考官網的https://raw.githubusercontent.com/kubernetes/dashboard/v1.8.1/src/deploy/recommended/kubernetes-dashboard.yaml
發現這個毛病,所有用了1.7的yaml,暫時沒去深究.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM