您好,登錄后才能下訂單哦!
這篇文章給大家分享的是有關Kubernetes 1.8.4中如何安裝Heapster的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
Heapster 是 Kubernetes 社區維護的容器集群監控分析工具。Heapster 會從 Kubernetes apiserver 獲得所有 Node 信息,然后再通過這些 Node 來獲得 kubelet 上的數據,最后再將所有收集到數據送到 Heapster 的后臺儲存 InfluxDB,最后利用 Grafana 來抓取 InfluxDB 的數據源來進行可視化。
在master通過 kubectl 來創建 kubernetes monitor 即可
生成kube-heapster.yml
cat <<EOF > kube-heapster.yml apiVersion: v1 kind: ServiceAccount metadata: name: heapster-sa namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: name: heapster-binding labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: system:heapster subjects: - kind: ServiceAccount name: heapster namespace: kube-system --- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: system:pod-nanny namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile rules: - apiGroups: - "" resources: - pods verbs: - get - apiGroups: - "extensions" resources: - deployments verbs: - get - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: heapster-binding namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile roleRef: apiGroup: rbac.authorization.k8s.io kind: Role name: system:pod-nanny subjects: - kind: ServiceAccount name: heapster namespace: kube-system --- kind: Service apiVersion: v1 metadata: name: heapster namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: ports: - port: 80 targetPort: 8082 selector: k8s-app: heapster --- apiVersion: v1 kind: Service metadata: name: monitoring-grafana namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: ports: - port: 80 protocol: TCP targetPort: ui selector: k8s-app: influxGrafana --- apiVersion: v1 kind: Service metadata: name: monitoring-influxdb namespace: kube-system labels: kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: ports: - name: http port: 8083 targetPort: 8083 - name: api port: 8086 targetPort: 8086 selector: k8s-app: influxGrafana --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: heapster labels: k8s-app: heapster kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile namespace: kube-system spec: replicas: 1 selector: matchLabels: k8s-app: heapster template: metadata: labels: k8s-app: heapster annotations: scheduler.alpha.kubernetes.io/critical-pod: '' spec: serviceAccountName: heapster-sa tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule - key: "CriticalAddonsOnly" operator: "Exists" containers: - image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64:v1.5.0-beta.0 name: heapster livenessProbe: httpGet: path: /healthz port: 8082 scheme: HTTP initialDelaySeconds: 180 timeoutSeconds: 5 command: - /heapster - --source=kubernetes.summary_api:'' - --sink=influxdb:http://monitoring-influxdb:8086 - image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-amd64:v1.5.0-beta.0 name: eventer command: - /eventer - --source=kubernetes:'' - --sink=influxdb:http://monitoring-influxdb:8086 - image: registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.7 name: heapster-nanny resources: limits: cpu: 100m memory: 128Mi requests: cpu: 50m memory: 90Mi env: - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: MY_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace command: - /pod_nanny - --cpu=80m - --extra-cpu=0.5m - --memory=140Mi - --extra-memory=4Mi - --threshold=5 - --deployment=heapster - --container=heapster - --poll-period=300000 - --estimator=exponential - image: registry.cn-hangzhou.aliyuncs.com/google_containers/addon-resizer:1.7 name: eventer-nanny resources: limits: cpu: 100m memory: 128Mi requests: cpu: 50m memory: 90Mi env: - name: MY_POD_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: MY_POD_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace command: - /pod_nanny - --cpu=100m - --extra-cpu=0m - --memory=190Mi - --extra-memory=500Ki - --threshold=5 - --deployment=heapster - --container=eventer - --poll-period=300000 - --estimator=exponential --- kind: Deployment apiVersion: extensions/v1beta1 metadata: name: influxdb-grafana namespace: kube-system labels: k8s-app: influxGrafana kubernetes.io/cluster-service: "true" addonmanager.kubernetes.io/mode: Reconcile spec: replicas: 1 selector: matchLabels: k8s-app: influxGrafana template: metadata: labels: k8s-app: influxGrafana annotations: scheduler.alpha.kubernetes.io/critical-pod: '' spec: tolerations: - key: node-role.kubernetes.io/master effect: NoSchedule - key: "CriticalAddonsOnly" operator: "Exists" containers: - name: influxdb image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-influxdb-amd64:v1.3.3 resources: limits: cpu: 100m memory: 500Mi requests: cpu: 100m memory: 500Mi ports: - name: http containerPort: 8083 - name: api containerPort: 8086 volumeMounts: - name: influxdb-persistent-storage mountPath: /data - name: grafana image: registry.cn-shenzhen.aliyuncs.com/rancher_cn/heapster-grafana-amd64:v4.4.3 env: resources: limits: cpu: 100m memory: 100Mi requests: cpu: 100m memory: 100Mi env: - name: INFLUXDB_SERVICE_URL value: http://monitoring-influxdb:8086 - name: GF_AUTH_BASIC_ENABLED value: "false" - name: GF_AUTH_ANONYMOUS_ENABLED value: "true" - name: GF_AUTH_ANONYMOUS_ORG_ROLE value: Admin - name: GF_SERVER_ROOT_URL value: /api/v1/proxy/namespaces/kube-system/services/monitoring-grafana/ ports: - name: ui containerPort: 3000 protocol: TCP volumeMounts: - name: grafana-persistent-storage mountPath: /var volumes: - name: influxdb-persistent-storage emptyDir: {} - name: grafana-persistent-storage emptyDir: {} EOF
kubectl apply -f kube-heapster.yml
查看狀態
kubectl -n kube-system get po,svc
完成后,就可以通過瀏覽器訪問Grafana Dashboard
https://10.0.0.162:6443/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana
感謝各位的閱讀!關于“Kubernetes 1.8.4中如何安裝Heapster”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。