91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析

發布時間:2021-12-24 16:05:02 來源:億速云 閱讀:106 作者:小新 欄目:大數據

這篇文章將為大家詳細講解有關Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。

一:前言

1.kubernetes-dashboard 官方提供的用戶管理Kubernets集群可視化工具

2.cAdvisor是用于監控容器運行狀態的利器之一。在kubernetes系統中,cAdvisor已經被默認集成到了kubelet組件內,當kubelet服務啟動時,它會自動啟動cAdvisor服務,然后cAdvisor會實時采集所在節點的性能指標及節點上運行的容器的性能指標。cAdvisor主頁顯示了主機的實時運行狀態,包括CPU使用情況、內存使用情況、網絡吞吐量及文件系統使用情況等信息。但是cAdvisor只提供了單機的容器資源占用情況,而在大規模容器集群中,需要對所有的Node和全部容器進行性能監控。這就需要一套工具來實現集群性能數據的采集、存儲和展示。

3.Heapster 提供整個集群的資源監控,并支持持久化數據存儲到InfluxDB或者其他的存儲后端。Heapster從kubelet提供的API采集節點和容器的資源占用。另外,Heapster的 /metrics API提供了Prometheus格式的數據。

4.InfluxDB是一個開源分布式時序、事件和指標數據庫。

5.Grafana是一個開源儀表盤工具,它可用于Graphite、InfluxDB與 OpenTSDB 一起使用。最新的版本還可以用于其他的數據源,比如Elasticsearch。(與heapster與Prometheus均可集成)

6.Zabbix是一個基于WEB界面的提供分布式系統監視以及網絡監視功能的企業級的開源解決方案.多用于傳統(非微服務)分布式系統的監控。

7.Prometheus 容器時代的產物。集成采集、存儲(支持多種時序數據庫)、頁面展示與一體的監控工具。

監控方案:
a.Heapster+InfluxDB+Grafana
b.Prometheus

二:安裝
1.鏡像
k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.2
gcr.io/google_containers/heapster-amd64:v1.4.2
gcr.io/google_containers/heapster-influxdb-amd64:v1.3.3 
gcr.io/google_containers/heapster-grafana-amd64:v4.4.3

2.yaml文件
Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析

admin-user.yaml(不需修改)

點擊(此處)折疊或打開

  1. apiVersion: v1

  2. kind: ServiceAccount

  3. metadata:

  4.   name: admin-user

  5.   namespace: kube-system

  6. ---

  7. apiVersion: rbac.authorization.k8s.io/v1

  8. kind: ClusterRoleBinding

  9. metadata:

  10.   name: admin-user

  11. roleRef:

  12.   apiGroup: rbac.authorization.k8s.io

  13.   kind: ClusterRole

  14.   name: cluster-admin

  15. subjects:

  16. - kind: ServiceAccount

  17.   name: admin-user

  18.   namespace: kube-system

dashboard.yaml(橙色標示是修改的地方。特別說明當前版本需要添加 - --heapster-host=http://heapster 配置,否則無法正常獲取metrics )

點擊(此處)折疊或打開

  1. # Copyright 2017 The Kubernetes Authors.

  2. #

  3. # Licensed under the Apache License, Version 2.0 (the "License");

  4. # you may not use this file except in compliance with the License.

  5. # You may obtain a copy of the License at

  6. #

  7. #     http://www.apache.org/licenses/LICENSE-2.0

  8. #

  9. # Unless required by applicable law or agreed to in writing, software

  10. # distributed under the License is distributed on an "AS IS" BASIS,

  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  12. # See the License for the specific language governing permissions and

  13. # limitations under the License.


  14. # Configuration to deploy release version of the Dashboard UI compatible with

  15. # Kubernetes 1.8.

  16. #

  17. # Example usage: kubectl create -f


  18. # ------------------- Dashboard Secret ------------------- #


  19. apiVersion: v1

  20. kind: Secret

  21. metadata:

  22.   labels:

  23.     k8s-app: kubernetes-dashboard

  24.   name: kubernetes-dashboard-certs

  25.   namespace: kube-system

  26. type: Opaque


  27. ---

  28. # ------------------- Dashboard Service Account ------------------- #


  29. apiVersion: v1

  30. kind: ServiceAccount

  31. metadata:

  32.   labels:

  33.     k8s-app: kubernetes-dashboard

  34.   name: kubernetes-dashboard

  35.   namespace: kube-system


  36. ---

  37. # ------------------- Dashboard Role & Role Binding ------------------- #


  38. kind: Role

  39. apiVersion: rbac.authorization.k8s.io/v1

  40. metadata:

  41.   name: kubernetes-dashboard-minimal

  42.   namespace: kube-system

  43. rules:

  44.   # Allow Dashboard to create 'kubernetes-dashboard-key-holder' secret.

  45. - apiGroups: [""]

  46.   resources: ["secrets"]

  47.   verbs: ["create"]

  48.   # Allow Dashboard to create 'kubernetes-dashboard-settings' config map.

  49. - apiGroups: [""]

  50.   resources: ["configmaps"]

  51.   verbs: ["create"]

  52.   # Allow Dashboard to get, update and delete Dashboard exclusive secrets.

  53. - apiGroups: [""]

  54.   resources: ["secrets"]

  55.   resourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"]

  56.   verbs: ["get", "update", "delete"]

  57.   # Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.

  58. - apiGroups: [""]

  59.   resources: ["configmaps"]

  60.   resourceNames: ["kubernetes-dashboard-settings"]

  61.   verbs: ["get", "update"]

  62.   # Allow Dashboard to get metrics from heapster.

  63. - apiGroups: [""]

  64.   resources: ["services"]

  65.   resourceNames: ["heapster"]

  66.   verbs: ["proxy"]

  67. - apiGroups: [""]

  68.   resources: ["services/proxy"]

  69.   resourceNames: ["heapster", "http:heapster:", "https:heapster:"]

  70.   verbs: ["get"]


  71. ---

  72. apiVersion: rbac.authorization.k8s.io/v1

  73. kind: RoleBinding

  74. metadata:

  75.   name: kubernetes-dashboard-minimal

  76.   namespace: kube-system

  77. roleRef:

  78.   apiGroup: rbac.authorization.k8s.io

  79.   kind: Role

  80.   name: kubernetes-dashboard-minimal

  81. subjects:

  82. - kind: ServiceAccount

  83.   name: kubernetes-dashboard

  84.   namespace: kube-system


  85. ---

  86. # ------------------- Dashboard Deployment ------------------- #


  87. kind: Deployment

  88. apiVersion: apps/v1beta2

  89. metadata:

  90.   labels:

  91.     k8s-app: kubernetes-dashboard

  92.   name: kubernetes-dashboard

  93.   namespace: kube-system

  94. spec:

  95.   replicas: 1

  96.   revisionHistoryLimit: 10

  97.   selector:

  98.     matchLabels:

  99.       k8s-app: kubernetes-dashboard

  100.   template:

  101.     metadata:

  102.       labels:

  103.         k8s-app: kubernetes-dashboard

  104.     spec:

  105.       containers:

  106.       - name: kubernetes-dashboard

  107.         image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.2

  108.         ports:

  109.         - containerPort: 8443

  110.           protocol: TCP

  111.         args:

  112.           - --auto-generate-certificates

  113.           # Uncomment the following line to manually specify Kubernetes API server Host

  114.           # If not specified, Dashboard will attempt to auto discover the API server and connect

  115.           # to it. Uncomment only if the default does not work.

  116.           # - --apiserver-host=http://my-address:port

  117.           - --heapster-host=http://heapster

  118.         volumeMounts:

  119.         - name: kubernetes-dashboard-certs

  120.           mountPath: /certs

  121.           # Create on-disk volume to store exec logs

  122.         - mountPath: /tmp

  123.           name: tmp-volume

  124.         livenessProbe:

  125.           httpGet:

  126.             scheme: HTTPS

  127.             path: /

  128.             port: 8443

  129.           initialDelaySeconds: 30

  130.           timeoutSeconds: 30

  131.       volumes:

  132.       - name: kubernetes-dashboard-certs

  133.         secret:

  134.           secretName: kubernetes-dashboard-certs

  135.       - name: tmp-volume

  136.         emptyDir: {}

  137.       serviceAccountName: kubernetes-dashboard

  138.       # Comment the following tolerations if Dashboard must not be deployed on master

  139.       tolerations:

  140.       - key: node-role.kubernetes.io/master

  141.         effect: NoSchedule


  142. ---

  143. # ------------------- Dashboard Service ------------------- #


  144. kind: Service

  145. apiVersion: v1

  146. metadata:

  147.   labels:

  148.     k8s-app: kubernetes-dashboard

  149.   name: kubernetes-dashboard

  150.   namespace: kube-system

  151. spec:

  152.   type: NodePort

  153.   ports:

  154.     - port: 443

  155.       targetPort: 8443

  156.       nodePort: 32666

  157.   selector:

  158.     k8s-app: kubernetes-dashboard

grafana.yaml(橙色標示為需要修改的地方)

點擊(此處)折疊或打開

  1. apiVersion: extensions/v1beta1

  2. kind: Deployment

  3. metadata:

  4.   name: monitoring-grafana

  5.   namespace: kube-system

  6. spec:

  7.   replicas: 1

  8.   template:

  9.     metadata:

  10.       labels:

  11.         task: monitoring

  12.         k8s-app: grafana

  13.     spec:

  14.       containers:

  15.       - name: grafana

  16.         image: gcr.io/google_containers/heapster-grafana-amd64:v4.4.3

  17.         ports:

  18.         - containerPort: 3000

  19.           protocol: TCP

  20.         volumeMounts:

  21.         - mountPath: /etc/ssl/certs

  22.           name: ca-certificates

  23.           readOnly: true

  24.         - mountPath: /var

  25.           name: grafana-storage

  26.         env:

  27.         - name: INFLUXDB_HOST

  28.           value: monitoring-influxdb

  29.         - name: GF_SERVER_HTTP_PORT

  30.           value: "3000"

  31.           # The following env variables are required to make Grafana accessible via

  32.           # the kubernetes api-server proxy. On production clusters, we recommend

  33.           # removing these env variables, setup auth for grafana, and expose the grafana

  34.           # service using a LoadBalancer or a public IP.

  35.         - name: GF_AUTH_BASIC_ENABLED

  36.           value: "false"

  37.         - name: GF_AUTH_ANONYMOUS_ENABLED

  38.           value: "true"

  39.         - name: GF_AUTH_ANONYMOUS_ORG_ROLE

  40.           value: Admin

  41.         - name: GF_SERVER_ROOT_URL

  42.           # If you're only using the API Server proxy, set this value instead:

  43.           # value: /api/v1/namespaces/kube-system/services/monitoring-grafana/proxy

  44.           value: /

  45.       volumes:

  46.       - name: ca-certificates

  47.         hostPath:

  48.           path: /etc/ssl/certs

  49.       - name: grafana-storage

  50.         emptyDir: {}

  51. ---

  52. apiVersion: v1

  53. kind: Service

  54. metadata:

  55.   labels:

  56.     # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)

  57.     # If you are NOT using this as an addon, you should comment out this line.

  58.     kubernetes.io/cluster-service: 'true

heapster-rbac.yaml(不需要修改)

點擊(此處)折疊或打開

  1. kind: ClusterRoleBinding

  2. apiVersion: rbac.authorization.k8s.io/v1beta1

  3. metadata:

  4.   name: heapster

  5. roleRef:

  6.   apiGroup: rbac.authorization.k8s.io

  7.   kind: ClusterRole

  8.   name: system:heapster

  9. subjects:

  10. - kind: ServiceAccount

  11.   name: heapster

  12.   namespace: kube-system

heapster.yaml(橙色標示為需要修改的地方)

點擊(此處)折疊或打開

  1. apiVersion: v1

  2. kind: ServiceAccount

  3. metadata:

  4.   name: heapster

  5.   namespace: kube-system

  6. ---

  7. apiVersion: extensions/v1beta1

  8. kind: Deployment

  9. metadata:

  10.   name: heapster

  11.   namespace: kube-system

  12. spec:

  13.   replicas: 1

  14.   template:

  15.     metadata:

  16.       labels:

  17.         task: monitoring

  18.         k8s-app: heapster

  19.     spec:

  20.       serviceAccountName: heapster

  21.       containers:

  22.       - name: heapster

  23.         image: gcr.io/google_containers/heapster-amd64:v1.4.2

  24.         imagePullPolicy: IfNotPresent

  25.         command:

  26.         - /heapster

  27.         - --source=kubernetes:https://10.116.137.196:6443

  28.         - --sink=influxdb:http://monitoring-influxdb.kube-system.svc:8086

  29. ---

  30. apiVersion: v1

  31. kind: Service

  32. metadata:

  33.   labels:

  34.     task: monitoring

  35.     # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)

  36.     # If you are NOT using this as an addon, you should comment out this line.

  37.     kubernetes.io/cluster-service: 'true'

  38.     kubernetes.io/name: Heapster

  39.   name: heapster

  40.   namespace: kube-system

  41. spec:

  42.   ports:

  43.   - port: 80

  44.     targetPort: 8082

  45.   selector:

  46.     k8s-app: heapster

influxdb.yaml(橙色標示為需要修改的地方)

點擊(此處)折疊或打開

  1. apiVersion: extensions/v1beta1

  2. kind: Deployment

  3. metadata:

  4.   name: monitoring-influxdb

  5.   namespace: kube-system

  6. spec:

  7.   replicas: 1

  8.   template:

  9.     metadata:

  10.       labels:

  11.         task: monitoring

  12.         k8s-app: influxdb

  13.     spec:

  14.       containers:

  15.       - name: influxdb

  16.         image: gcr.io/google_containers/heapster-influxdb-amd64:v1.3.3

  17.         volumeMounts:

  18.         - mountPath: /data

  19.           name: influxdb-storage

  20.       volumes:

  21.       - name: influxdb-storage

  22.         emptyDir: {}

  23. ---

  24. apiVersion: v1

  25. kind: Service

  26. metadata:

  27.   labels:

  28.     task: monitoring

  29.     # For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)

  30.     # If you are NOT using this as an addon, you should comment out this line.

  31.     kubernetes.io/cluster-service: 'true'

  32.     kubernetes.io/name: monitoring-influxdb

  33.   name: monitoring-influxdb

  34.   namespace: kube-system

  35. spec:

  36.   ports:

  37.   - port: 8086

  38.     targetPort: 8086

  39.   selector:

  40.     k8s-app: influxdb

dashboard.yaml 文件源于https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml

其他yaml.文件源于
https://codeload.github.com/kubernetes/heapster/zip/v1.4.2  下載后解壓縮  位于目錄\deploy\kube-config\influxdb

3.創建相關資源
執行命令:
kubectl create -f admin-user.yaml -f dashboard.yaml -f grafana.yaml -f heapster-rbac.yaml -f heapster.yaml -f influxdb.yaml
查看創建狀態:
kubectl get pods --all-namespaces
Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析
三:訪問
建議使用Firefox瀏覽器訪問https://nodeIp:32666

Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析

選擇使用令牌登錄的方式,  生成令牌的命令如下(請保存好生成的Token):

點擊(此處)折疊或打開

  1. kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token

成功登錄后的頁面:
Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析

關于“Kubernetes-dashboard+Heapster+InfluxDB+Grafana的示例分析”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

梁平县| 勐海县| 青冈县| 仲巴县| 北流市| 奉新县| 清原| 永德县| 同江市| 新源县| 肇东市| 盐津县| 通榆县| 泸水县| 闵行区| 宿松县| 水富县| 巧家县| 黑水县| 昌都县| 五华县| 英德市| 桑植县| 新郑市| 淮北市| 吴江市| 平陆县| 土默特右旗| 方山县| 迭部县| 祁东县| 兰溪市| 景泰县| 仪陇县| 长泰县| 高雄市| 烟台市| 苗栗县| 调兵山市| 双柏县| 阳信县|