Demonstrate How to Expose TimesTen Kubernetes Operator Metrics
Let's walk through an example illustrating how the TimesTen Kubernetes Operator exposes metrics about its own functionality as well as the status of TimesTenClassic or TimesTenScaleout objects. Let's assume Prometheus is installed in your Kubernetes cluster and you have a Prometheus server running in your namespace.
-
https or http?: Let's choose https. The
METRICS_SCHEME
environment variable determines if metrics should be made available by https or http. A setting of"1"
(default) indicates https. -
Create a ServiceMonitor object?: Let's have the TimesTen Operator create a ServiceMonitor object. This object contains the information needed by Prometheus to configure the TimesTen Operator as a scrape target. The
CREATE_SERVICEMONITOR
environment variable determines if the TimesTen Operator should create a ServiceMonitor object. A setting of"1"
(default) indicates the TimesTen Operator should create the object. -
Expose TimesTen Operator metrics outside of the TimesTen Operator Pods?: Let's have the metrics exposed outside of the TimesTen Operator Pods so that Prometheus can scrape metrics from it. The
EXPOSE_METRICS
environment variable determines if metrics are exposed outside of the TimesTen Operator Pods. A setting of"1"
(default) indicates metrics should be exposed. This means that the TimesTen Operator will create a Kubernetes Service (calledtimesten-operator
) that allows the/metrics
endpoint to be available to other Pods in the Kubernetes cluster.
Since we have chosen the defaults for the TimesTen Operator environment variables, you do not have to modify these variables in the operator.yaml
YAML manifest file. For more information about the operator.yaml
YAML manifest file, see Customize the TimesTen Operator.
Congratulations! You successfully walked through an example demonstrating how TimesTen Operator metrics are exposed, scraped, and published.