Installing Prometheus
Prometheus is an open-source software used for event monitoring and alarm reporting.
MCP can use Prometheus to report monitoring data of Kubernetes clusters to the monitoring center. To use this function, install Prometheus in the Kubernetes clusters.
Procedure
Use the Prometheus chart in the Kubernetes chart repository to install Prometheus. The Prometheus chart contains the following components. You can determine whether to deploy the components by setting corresponding parameters. By default, all components are deployed. This example shows how to set installation parameters for customized deployment.
- alertmanager: alarm center of the add-on. It receives alarms sent by Prometheus and manages alarm information through deduplication, grouping, and distribution.
- kube-state-metrics: converts the Prometheus metric data into a format that can be identified by Kubernetes APIs.
- node-exporter: deployed on each node to collect node monitoring data.
- pushgateway: intermediate component used to receive metrics. The Prometheus server obtains data from it.
- prometheus server: data collection server used for monitoring.
For details about the Prometheus chart, see https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus.
- Connect to the cluster using kubectl.
- Install Helm3.
wget https://get.helm.sh/helm-v3.6.1-linux-amd64.tar.gz
Decompress the file and save the helm binary file to the /usr/local/bin directory.tar zxvf helm-v3.6.1-linux-amd64.tar.gz mv linux-amd64/helm /usr/local/bin/helm
- Add a helm image repository.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update
Run the helm repo list command to view the added helm image repository.
NAME URL prometheus-community https://prometheus-community.github.io/helm-charts
- Create a value.yaml file and set installation parameters.
vi value.yaml
You can configure the file content by referring to the following example.
pushgateway: enabled: false # Do not install pushgateway. alertmanager: persistentVolume: existingClaim: pvc-name # The PVC must be created in advance. server: # Configuration of the Prometheus server persistentVolume: # Local persistent storage existingClaim: pvc-name global: external_labels:
Configuration description:
- pushgateway: generally not required to be deployed. You can set pushgateway.enabled to false to skip the deployment.
- alertermanager: deployed through a Deployment by default.
- persistentVolume.existingClaim: Use an existing PVC name in the cluster and persistent storage to store local data.
- server: deployed through a Deployment by default.
- persistentVolume.existingClaim: Use an existing PVC name in the cluster and persistent storage to store local data. By default, data is stored for 15 days.
- Install Prometheus.
helm install prometheus prometheus-community/prometheus --namespace monitoring --values value.yaml
- --namespace: Specify a namespace for installing Prometheus. You need to manually create it in advance.
- --values: Specify Prometheus installation parameters as described in 4.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot