Configuring Prometheus and Grafana
The helm chart for PolarDB-X Monitor uses the default configurations for Prometheus and Grafana. If you wish to modify the related configurations, you can install or upgrade the PolarDB-X Monitor using the following commands and override the default settings with a values.yaml
file.
helm install --namespace polardbx-monitor polardbx-monitor polardbx-monitor-1.6.0.tgz -f values.yaml
or:
helm upgrade --namespace polardbx-monitor polardbx-monitor polardbx-monitor-1.6.0.tgz -f values.yaml
The values.yaml file contains configuration items for Prometheus and Grafana. Below are configuration examples for common scenarios. For a detailed list of configurations, please visit: values.yaml 。
Configuring LoadBalancer
If your K8s cluster supports LoadBalancer, you can specify the following configuration when installing or upgrading PolarDB-X Monitor with the -f parameter:
monitors:
grafana:
serviceType: LoadBalancer
prometheus:
serviceType: LoadBalancer
Persisting Monitoring Data
By default, the monitoring data for the created Prometheus cluster is not persisted, which poses a risk of data loss. You can specify a directory for data persistence in your values.yaml file as follows:
monitors:
prometheus:
persist: true
# Storage class supported within the K8s cluster
storageClassName: ssd
# Size of the storage space
storageRequest: 100G
Configuring the Specifications for Prometheus and Grafana
In the default configuration, the Prometheus cluster includes one node with 8C16G of resources allocated, and Grafana includes one node with 4C8G of resources allocated. You can modify the specifications and the number of nodes for the Prometheus and Grafana clusters using the following configuration items:
monitors:
grafana:
resources:
requests:
cpu: 1000m
memory: 2Gi
limits:
cpu: 2000m
memory: 8Gi
prometheus:
resources:
requests:
cpu: 1000m
memory: 2Gi
limits:
cpu: 2000m
memory: 8Gi