Monitor Trident protect resources
You can use the kube-state-metrics, Prometheus, and Alertmanager open source tools to monitor the health of the resources protected by Trident protect.
The kube-state-metrics service generates metrics from Kubernetes API communication. Using it with Trident protect exposes useful information about the state of resources in your environment.
Prometheus is a toolkit that can ingest the data generated by kube-state-metrics and present it as easily readable information about these objects. Together, kube-state-metrics and Prometheus provide a way for you to monitor the health and status of the resources you are managing with Trident protect.
Alertmanager is a service that ingests the alerts sent by tools such as Prometheus and routes them to destinations that you configure.
|
The configurations and guidance included in these steps are only examples; you need to customize them to match your environment. Refer to the following official documentation for specific instructions and support: |
Step 1: Install the monitoring tools
To enable resource monitoring in Trident protect, you need to install and configure kube-state-metrics, Promethus, and Alertmanager.
Install kube-state-metrics
You can install kube-state-metrics using Helm.
-
Add the kube-state-metrics Helm chart. For example:
-
Create a configuration file for the Helm chart (for example,
metrics-config.yaml
). You can customize the following example configuration to match your environment:metrics-config.yaml: kube-state-metrics Helm chart configuration -
Install kube-state-metrics by deploying the Helm chart. For example:
-
Configure kube-state-metrics to generate metrics for the custom resources used by Trident protect by following the instructions in the kube-state-metrics custom resource documentation.
Install Prometheus
You can install Prometheus by following the instructions in the Prometheus documentation.
Install Alertmanager
You can install Alertmanager by following the instructions in the Alertmanager documentation.
Step 2: Configure the monitoring tools to work together
After you install the monitoring tools, you need to configure them to work together.
-
Integrate kube-state-metrics with Prometheus. Edit the Prometheus configuration file (
prometheus.yml
) and add the kube-state-metrics service information. For example:prometheus.yml: kube-state-metrics service integration with Prometheus -
Configure Prometheus to route alerts to Alertmanager. Edit the Prometheus configuration file (
prometheus.yml
) and add the following section:prometheus.yml: Send alerts to Alertmanager
Prometheus can now gather metrics from kube-state-metrics, and can send alerts to Alertmanager. You are now ready to configure what conditions trigger an alert and where the alerts should be sent.
Step 3: Configure alerts and alert destinations
After you configure the tools to work together, you need to configure what type of information triggers alerts, and where the alerts should be sent.
Alert example: backup failure
The following example defines a critical alert that is triggered when the status of the backup custom resource is set to Error
for 5 seconds or longer. You can customize this example to match your environment, and include this YAML snippet in your prometheus.yml
configuration file:
Configure Alertmanager to send alerts to other channels
You can configure Alertmanager to send notifications to other channels, such as e-mail, PagerDuty, Microsoft Teams, or other notification services by specifying the respective configuration in the alertmanager.yml
file.
The following example configures Alertmanager to send notifications to a Slack channel. To customize this example to your environment, replace the value of the api_url
key with the Slack webhook URL used in your environment: