About the Prometheus Operator
Note:
You can expose TimesTen metrics to any scraping target. Our documentation focuses on Prometheus.There are several ways to configure Prometheus in Kubernetes. One of the most popular is the Prometheus Operator. The Prometheus Operator simplifies the deployment, monitoring, and management of Prometheus in Kubernetes.
Note:
It is beyond the scope of this book to detail how to create an object of type Prometheus. Refer to the Prometheus Operator documentation.The Prometheus Operator also simplifies the configuration of Prometheus servers that it deploys. The Prometheus Operator can automatically edit the Prometheus server's configuration files to include data sources that should be scraped from the /metrics
endpoint. This is done through the creation of Kubernetes objects of type ServiceMonitor and of type PodMonitor. (The ServiceMonitor object type is discussed in About Creating ServiceMonitor Objects.)
For details on these object types, see Prometheus Operator API Reference.
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: sample
spec:
selector:
matchLabels:
app: sample
podMetricsEndpoints:
- port: metrics
If you create such a PodMonitor object, the Prometheus Operator automatically responds by editing the Prometheus server's configuration files to cause the Prometheus server to scrape metrics from any Pod created with a label of app: sample
. All Pods with the specified label automatically appear as scrape targets in Kubernetes. As Pods matching the selector are created or deleted, the Prometheus configuration is automatically kept in synchronization.
Using a Prometheus Operator offers a simplified approach to not only deploying, managing, and monitoring Prometheus, but also configuring Prometheus servers.