Problem:

There are two problems with Prometheus monitoring setup: the retention setting isn’t functioning correctly, leading to excessive data storage, and the Prometheus database is frequently getting corrupted, despite varying levels of workload and resource allocation across different environments.

Process:

Case Details:

  • Environment 1: a high-load environment with over a thousand pods, where Prometheus generated tens of gigabytes of data within a few hours.
  • Environment 2: an environment with a much lower load and several hundred pods, where Prometheus generated less than a gigabyte of data per hour.

Upon investigating the issue, the following data was requested from the client:

  • Configuration files
  • Prometheus logs
  • values.yaml
  • Kubernetes cluster metrics during periods of high data generation
  • Prometheus alerting rules configured for the setup
  • CPU metrics
  • Prometheus version
  • Configuration of Prometheus Alertmanager
  • Any Prometheus exporters or related components deployed in the environment that might contribute to data generation or database issues

Solution:

The client was advised to:

  1. Check Prometheus CRD to find data retention information and details.
  2. Consider upgrading Prometheus to a newer version.

Conclusion:

The investigation narrowed the issues down to the retention configuration defined in the Prometheus CRD and the Prometheus version in use. Verifying the retention settings and upgrading Prometheus were the recommended steps to address both the excessive data storage and the database corruption.