In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Environment description:
Hostname operating system version ipdocker versionkubelet versionhelm version configuration remarks masterCentos 7.6.1810172.27.9.131Docker 18.09.6V1.14.2v2.14.32C2Gmaster host node01Centos 7.6.1810172.27.9.135Docker 18.09.6V1.14.2v2.14.32C2Gnode node node02Centos 7.6.1810172.27.9.136Docker 18.09.6V1.14.2v2.14.32C2Gnode node
For more information on k8s cluster deployment, please see Centos7.6 deployment k8s (v1.14.2) cluster.
For more information on K8s learning materials, see: basic concepts, kubectl commands and data sharing.
For more information on k8s high availability cluster deployment, please see Centos7.6 deployment k8s v1.16.4 high availability cluster (active / standby mode)
A brief introduction to prometheus
Prometheus is an open source system monitoring and alerting toolkit originally built on soundcloud. Since its inception in 2012, many companies and organizations have adopted Prometheus, which has a very active community of developers and users. It is now an independent open source project, maintained independently of any company, and joined the Cloud Native Computing Foundation in 2016, becoming the second managed project after kubernetes.
Features:
Flexible query language for multidimensional data models that identify time series data with measurement names and keys does not depend on distributed storage; single server nodes are autonomous for time series collection through the pull model on http; support for push time series through intermediate gateways multiple graphics and dashboard support patterns for target discovery through service discovery or static configuration
In the micro-service architecture, it has good support for multi-dimensional data collection and query.
II. Prometheus architecture
Prometheus obtains metrics data from jobs, as well as temporary jobs metrics directly or through push gateways. It stores all acquired samples locally, runs rules on these data, aggregates existing data and records new time series, or generates alerts. Through Grafana or other API consumers, you can visually view the collected data.
III. Introduction to Prometheus Operator
Prometheus Operator is a Kubernetes monitoring scheme based on Prometheus developed by CoreOS.
Prometheus Operator: the best way to integrate Kubernetes and Prometheus.
Prometheus Operator features more:
Create / destroy: it is easier to start an instance of prometheus in Kubernetes namespace, and it is easier for a particular application or team to use Operator. Simple configuration: configure the basics of Prometheus, such as versions, persistence, retention policies, and copies from native kubernetes resources. Target service through tags: automatically generate monitoring target configuration based on common Kubernetes label queries; there is no need to learn prometheus-specific configuration language.
Workflow:
4. Prometheus Operator deployment 1. Download the installation file [root@master ~] # git clone https://github.com/coreos/kube-prometheus.git
two。 Image download
Download the image:
Docker pull registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1docker pull registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/kube-rbac-proxy:v0.4.1docker pull registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0.18.1docker pull registry.cn-hangzhou. Aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0docker pull registry.cn-hangzhou.aliyuncs.com/loong576/grafana:6.4.3
Call tag:
Docker tag registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1 quay.io/coreos/configmap-reload:v0.0.1docker tag registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0 quay.io/prometheus/alertmanager:v0.18.0docker tag registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0 quay.io/coreos/kube-state-metrics:v1.8.0docker tag registry.cn-hangzhou.aliyuncs .com / loong576/kube-rbac-proxy:v0.4.1 quay.io/coreos/kube-rbac-proxy:v0.4.1docker tag registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0.18.1 quay.io/prometheus/node-exporter:v0.18.1docker tag registry.cn-hangzhou.aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0 quay.io/coreos/k8s-prometheus-adapter-amd64:v0.5.0docker tag registry.cn- Hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0 quay.io/coreos/prometheus-config-reloader:v0.33.0docker tag registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0 quay.io/prometheus/prometheus:v2.11.0docker tag registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0 quay.io/coreos/prometheus-operator:v0.33.0docker tag registry.cn-hangzhou.aliyuncs.com/loong576/grafana : 6.4.3 grafana/grafana:6.4.3
Delete the mirror:
Docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/configmap-reload:v0.0.1docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/alertmanager:v0.18.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/kube-state-metrics:v1.8.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/kube-rbac-proxy:v0.4.1docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/node-exporter:v0. 18.1docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/k8s-prometheus-adapter-amd64:v0.5.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-config-reloader:v0.33.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/prometheus:v2.11.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/prometheus-operator:v0.33.0docker rmi-f registry.cn-hangzhou.aliyuncs.com/loong576/grafana:6.4.3
All node nodes perform the above three steps
3. Perform the installation of [root@master kube-prometheus] # kubectl create-f manifests/setup [root@master kube-prometheus] # kubectl create-f manifests/4. For resources, see [root@master kube-prometheus] # kubectl get all-n monitoring [root@master kube-prometheus] # kubectl get prometheus-- all-namespaces-o wide
All resources are in the monitoring namespace.
5. Change the access method [root@master kube-prometheus] # kubectl edit-n monitoring service prometheus-k8sservice/prometheus-k8s edited [root@master kube-prometheus] # kubectl edit-n monitoring service grafanaservice/grafana edited [root@master kube-prometheus] # kubectl edit-n monitoring service alertmanager-mainservice/alertmanager-main edited
Modify the service prometheus-k8s, grafana and alertmanager-main,service types to NodePort, and the ports are 30021, 30022 and 30023 respectively.
Fifth, page display 1. Visit Prometheus
Http://172.27.9.131:30021
two。 Visit Alert Manager
Http://172.27.9.131:30023
3. Visit Grafana
Http://172.27.9.131:30022 username and password are all admin
Built-in template View:
View the cluster resources:
Kubelet View:
StatefulSets View:
Pod View:
API View:
Namespace View:
View the resource usage of each node:
Prometheus View:
Other templates:
There are plenty of templates that come with it, but you can also download other templates, such as'1 Node Exporter for Prometheus monitoring Kanban updatekeeper' Https://grafana.com/api/dashboards/8919/revisions/10/download
6. Prometheus Operator uninstall [root@master kube-prometheus] # kubectl delete-- ignore-not-found=true-f manifests/-f manifests/setup
All scripts and configuration files in this article have been uploaded: K8s practice (12): Prometheus Operator Monitoring Kubernetes Cluster
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: 0
*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.