In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain the example analysis of Kubernetes-dashboard+Heapster+InfluxDB+Grafana for you in detail. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
One: preface
1.kubernetes-dashboard official user Management Kubernets Cluster Visualization tool
2.cAdvisor is one of the powerful tools used to monitor the running status of containers. In the kubernetes system, cAdvisor has been integrated into the kubelet component by default. When the kubelet service starts, it automatically starts the cAdvisor service, and then cAdvisor will collect the performance indicators of the node and the container running on the node in real time. The cAdvisor home page shows the real-time running status of the host, including CPU usage, memory usage, network throughput, and file system usage. However, cAdvisor only provides stand-alone container resource utilization, while in a large-scale container cluster, you need to monitor the performance of all Node and all containers. This requires a set of tools to collect, store and display cluster performance data.
3.Heapster provides resource monitoring for the entire cluster and supports persistent data storage to InfluxDB or other storage backends. Heapster collects the resource consumption of nodes and containers from the API provided by kubelet. In addition, Heapster's / metrics API provides data in Prometheus format.
4.InfluxDB is an open source distributed database of timing, events, and metrics.
5.Grafana is an open source dashboard tool that can be used with Graphite, InfluxDB and OpenTSDB. The latest version can also be used for other data sources, such as Elasticsearch. (can be integrated with both heapster and Prometheus)
6.Zabbix is an enterprise-level open source solution based on WEB interface that provides distributed system monitoring and network monitoring. It is mostly used for the monitoring of traditional (non-micro-service) distributed systems.
The product of the age of 7.Prometheus containers. Integrated collection, storage (supporting a variety of time series databases), page display and integrated monitoring tools.
Monitoring scheme:
A.Heapster+InfluxDB+Grafana
B.Prometheus
Two: installation
1. Mirror image
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 file
Admin-user.yaml (no modification required)
Click (here) to collapse or open
ApiVersion: v1
Kind: ServiceAccount
Metadata:
Name: admin-user
Namespace: kube-system
-
ApiVersion: rbac.authorization.k8s.io/v1
Kind: ClusterRoleBinding
Metadata:
Name: admin-user
RoleRef:
ApiGroup: rbac.authorization.k8s.io
Kind: ClusterRole
Name: cluster-admin
Subjects:
-kind: ServiceAccount
Name: admin-user
Namespace: kube-system
Dashboard.yaml (marked in orange is the place to be modified. Note that the current version needs to add-heapster-host= http://heapster configuration, otherwise the metrics cannot be obtained normally)
Click (here) to collapse or open
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "ASIS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Configuration to deploy release version of the Dashboard UI compatible with
# Kubernetes 1.8.
#
# Example usage: kubectl create-f
#-Dashboard Secret-#
ApiVersion: v1
Kind: Secret
Metadata:
Labels:
K8s-app: kubernetes-dashboard
Name: kubernetes-dashboard-certs
Namespace: kube-system
Type: Opaque
-
#-Dashboard Service Account-#
ApiVersion: v1
Kind: ServiceAccount
Metadata:
Labels:
K8s-app: kubernetes-dashboard
Name: kubernetes-dashboard
Namespace: kube-system
-
#-Dashboard Role & Role Binding-#
Kind: Role
ApiVersion: rbac.authorization.k8s.io/v1
Metadata:
Name: kubernetes-dashboard-minimal
Namespace: kube-system
Rules:
# Allow Dashboard to create 'kubernetes-dashboard-key-holder' secret.
-apiGroups: ["]
Resources: ["secrets"]
Verbs: ["create"]
# Allow Dashboard to create 'kubernetes-dashboard-settings' config map.
-apiGroups: ["]
Resources: ["configmaps"]
Verbs: ["create"]
# Allow Dashboard to get, update and delete Dashboard exclusive secrets.
-apiGroups: ["]
Resources: ["secrets"]
ResourceNames: ["kubernetes-dashboard-key-holder", "kubernetes-dashboard-certs"]
Verbs: ["get", "update", "delete"]
# Allow Dashboard to get and update 'kubernetes-dashboard-settings' config map.
-apiGroups: ["]
Resources: ["configmaps"]
ResourceNames: ["kubernetes-dashboard-settings"]
Verbs: ["get", "update"]
# Allow Dashboard to get metrics from heapster.
-apiGroups: ["]
Resources: ["services"]
ResourceNames: ["heapster"]
Verbs: ["proxy"]
-apiGroups: ["]
Resources: ["services/proxy"]
ResourceNames: ["heapster", "http:heapster:", "https:heapster:"]
Verbs: ["get"]
-
ApiVersion: rbac.authorization.k8s.io/v1
Kind: RoleBinding
Metadata:
Name: kubernetes-dashboard-minimal
Namespace: kube-system
RoleRef:
ApiGroup: rbac.authorization.k8s.io
Kind: Role
Name: kubernetes-dashboard-minimal
Subjects:
-kind: ServiceAccount
Name: kubernetes-dashboard
Namespace: kube-system
-
#-Dashboard Deployment-#
Kind: Deployment
ApiVersion: apps/v1beta2
Metadata:
Labels:
K8s-app: kubernetes-dashboard
Name: kubernetes-dashboard
Namespace: kube-system
Spec:
Replicas: 1
RevisionHistoryLimit: 10
Selector:
MatchLabels:
K8s-app: kubernetes-dashboard
Template:
Metadata:
Labels:
K8s-app: kubernetes-dashboard
Spec:
Containers:
-name: kubernetes-dashboard
Image: k8s.gcr.io/kubernetes-dashboard-amd64:v1.8.2
Ports:
-containerPort: 8443
Protocol: TCP
Args:
-auto-generate-certificates
# 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
-heapster-host= http://heapster
VolumeMounts:
-name: kubernetes-dashboard-certs
MountPath: / certs
# Create on-disk volume to store exec logs
-mountPath: / tmp
Name: tmp-volume
LivenessProbe:
HttpGet:
Scheme: HTTPS
Path: /
Port: 8443
InitialDelaySeconds: 30
TimeoutSeconds: 30
Volumes:
-name: kubernetes-dashboard-certs
Secret:
SecretName: kubernetes-dashboard-certs
-name: tmp-volume
EmptyDir: {}
ServiceAccountName: kubernetes-dashboard
# Comment the following tolerations if Dashboard must not be deployed on master
Tolerations:
-key: node-role.kubernetes.io/master
Effect: NoSchedule
-
#-Dashboard Service-#
Kind: Service
ApiVersion: v1
Metadata:
Labels:
K8s-app: kubernetes-dashboard
Name: kubernetes-dashboard
Namespace: kube-system
Spec:
Type: NodePort
Ports:
-port: 443
TargetPort: 8443
NodePort: 32666
Selector:
K8s-app: kubernetes-dashboard
Grafana.yaml (marked in orange as areas to be modified)
Click (here) to collapse or open
ApiVersion: extensions/v1beta1
Kind: Deployment
Metadata:
Name: monitoring-grafana
Namespace: kube-system
Spec:
Replicas: 1
Template:
Metadata:
Labels:
Task: monitoring
K8s-app: grafana
Spec:
Containers:
-name: grafana
Image: gcr.io/google_containers/heapster-grafana-amd64:v4.4.3
Ports:
-containerPort: 3000
Protocol: TCP
VolumeMounts:
-mountPath: / etc/ssl/certs
Name: ca-certificates
ReadOnly: true
-mountPath: / var
Name: grafana-storage
Env:
-name: INFLUXDB_HOST
Value: monitoring-influxdb
-name: GF_SERVER_HTTP_PORT
Value: "3000"
# The following env variables are required to make Grafana accessible via
# the kubernetes api-server proxy. On production clusters, we recommend
# removing these env variables, setup auth for grafana, and expose the grafana
# service using a LoadBalancer or a public IP.
-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
# If you're only using the API Server proxy, set this value instead:
# value: / api/v1/namespaces/kube-system/services/monitoring-grafana/proxy
Value: /
Volumes:
-name: ca-certificates
HostPath:
Path: / etc/ssl/certs
-name: grafana-storage
EmptyDir: {}
-
ApiVersion: v1
Kind: Service
Metadata:
Labels:
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
Kubernetes.io/cluster-service: 'true
Heapster-rbac.yaml (no modification required)
Click (here) to collapse or open
Kind: ClusterRoleBinding
ApiVersion: rbac.authorization.k8s.io/v1beta1
Metadata:
Name: heapster
RoleRef:
ApiGroup: rbac.authorization.k8s.io
Kind: ClusterRole
Name: system:heapster
Subjects:
-kind: ServiceAccount
Name: heapster
Namespace: kube-system
Heapster.yaml (marked in orange as areas to be modified)
Click (here) to collapse or open
ApiVersion: v1
Kind: ServiceAccount
Metadata:
Name: heapster
Namespace: kube-system
-
ApiVersion: extensions/v1beta1
Kind: Deployment
Metadata:
Name: heapster
Namespace: kube-system
Spec:
Replicas: 1
Template:
Metadata:
Labels:
Task: monitoring
K8s-app: heapster
Spec:
ServiceAccountName: heapster
Containers:
-name: heapster
Image: gcr.io/google_containers/heapster-amd64:v1.4.2
ImagePullPolicy: IfNotPresent
Command:
-/ heapster
-source=kubernetes: https://10.116.137.196:6443
-sink=influxdb: http://monitoring-influxdb.kube-system.svc:8086
-
ApiVersion: v1
Kind: Service
Metadata:
Labels:
Task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
Kubernetes.io/cluster-service: 'true'
Kubernetes.io/name: Heapster
Name: heapster
Namespace: kube-system
Spec:
Ports:
-port: 80
TargetPort: 8082
Selector:
K8s-app: heapster
Influxdb.yaml (marked in orange as areas to be modified)
Click (here) to collapse or open
ApiVersion: extensions/v1beta1
Kind: Deployment
Metadata:
Name: monitoring-influxdb
Namespace: kube-system
Spec:
Replicas: 1
Template:
Metadata:
Labels:
Task: monitoring
K8s-app: influxdb
Spec:
Containers:
-name: influxdb
Image: gcr.io/google_containers/heapster-influxdb-amd64:v1.3.3
VolumeMounts:
-mountPath: / data
Name: influxdb-storage
Volumes:
-name: influxdb-storage
EmptyDir: {}
-
ApiVersion: v1
Kind: Service
Metadata:
Labels:
Task: monitoring
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
# If you are NOT using this as an addon, you should comment out this line.
Kubernetes.io/cluster-service: 'true'
Kubernetes.io/name: monitoring-influxdb
Name: monitoring-influxdb
Namespace: kube-system
Spec:
Ports:
-port: 8086
TargetPort: 8086
Selector:
K8s-app: influxdb
The dashboard.yaml file is derived from https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
Other yaml. The document is derived from
After downloading https://codeload.github.com/kubernetes/heapster/zip/v1.4.2, unzip the directory\ deploy\ kube-config\ influxdb
3. Create related resources
Execute the command:
Kubectl create-f admin-user.yaml-f dashboard.yaml-f grafana.yaml-f heapster-rbac.yaml-f heapster.yaml-f influxdb.yaml
View the creation status:
Kubectl get pods-all-namespaces
Three: visit
It is recommended to use a Firefox browser to access https://nodeIp:32666
Choose to log in with a token, and the command to generate the token is as follows (please save the generated Token):
Click (here) to collapse or open
Kubectl-n kube-system describe secret $(kubectl-n kube-system get secret | grep admin-user | awk'{print $1}') | grep token
The page after successful login:
This is the end of this article on "sample Analysis of Kubernetes-dashboard+Heapster+InfluxDB+Grafana". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 287
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.