About Exposing Metrics from the TimesTen Kubernetes Operator

By default, the TimesTen Kubernetes Operator exposes metrics about its own functionality as well as the status of TimesTenClassic and TimesTenScaleout objects it manages.

Let's look at how the TimesTen Operator does this. Let's examine the default behavior and let's determine how you can change the default behavior if you choose to do so.

By default, the TimesTen Operator does the following:

  • Exports and exposes metrics about its own functionality and the overall status of the TimesTenClassic and TimesTenScaleout objects that it manages.

  • Uses https/Transport Layer Security (mutual TLS) to make these metrics available.

  • Automatically creates certificates, Oracle Wallets, and Kubernetes Secrets required for TLS.

  • If the Prometheus Operator is installed, creates the appropriate objects to cause Prometheus to be automatically modified, which then causes Prometheus to scrape metrics from the TimesTen Operator.

  • Exposes metrics outside of the TimesTen Operator Pods.

Although this default behavior is recommended, you have the option of changing the default behavior. Let's examine our options:

  • https or http?: TimesTen Operator metrics are available by https (default) or http.

  • Create a Kubernetes ServiceMonitor object?: If the Prometheus Operator is installed in your Kubernetes cluster, the TimesTen Operator can create a Kubernetes ServiceMonitor object. This object contains the information needed by the Prometheus Operator to configure the TimesTen Operator as a scrape target. If the Prometheus Operator has been installed in your Kubernetes cluster, then by default the TimesTen Operator creates a ServiceMonitor object.

  • Expose TimesTen Operator metrics outside of the TimesTen Operator Pods?: The TimesTen Operator listens on and accepts GETs on the timesten-operator.mynamespace.svc.cluster.local:8080/metrics endpoint (where mynamespace is the name of your namespace). By default, the TimesTen Operator deploys a Kubernetes Service that makes this endpoint available to other Pods in the Kubernetes cluster. You can choose not to create this Service.

Now, let's look at how we can change the default behavior.

The TimesTen Operator is deployed in your namespace as a Kubernetes Deployment. We provide an operator.yaml YAML manifest file that lets you customize this Deployment. The file is located in the deploy directory of the TimesTen Operator distribution. For more information, see About Deploying the TimesTen Operator.

The operator.yaml file contains various environment variables. Three of these variables govern if and how the TimesTen Operator exports and exposes metrics about its own operation and the status of the TimesTenClassic and TimesTenScaleout objects that it manages.

  • METRICS_SCHEME: Determines if metrics should be made available by https or http. A setting of "https" (default) indicates https should be used. A setting of "http" indicates http should be used.

  • CREATE_SERVICEMONITOR: Determines if the TimesTen Operator should create a Kubernetes ServiceMonitor object (discussed in a later section). A setting of "1" (default) indicates the TimesTen Operator should create a ServiceMonitor object. A setting of "0" indicates the TimesTen Operator should not create a ServiceMonitor object.

  • EXPOSE_METRICS: Determines if metrics are exposed outside of the TimesTen Operator Pods. A setting of "1" (default) indicates metrics should be exposed outside of the TimesTen Operator Pods. A setting of "0" indicates metrics should not be exposed outside of the TimesTen Operator Pods.

Let's look at a snippet of an operator.yaml file that shows the existence of these environment variables and the default settings.

# Copyright (c) 2019 - 2023, Oracle and/or its affiliates.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: timesten-operator
spec:
...          
          env:
            ...
            - name: EXPOSE_METRICS
              value: "1"
            - name: METRICS_SCHEME
              value: "https"
            - name: EXPOSE_PROBES
              value: "1"
            - name: CREATE_SERVICEMONITOR
              value: "1"
...
For reference information about these variables, see TimesTen Kubernetes Operator Environment Variables.

Note:

TimesTen Operator metrics are accurate when you have one TimesTen Operator defined in your TimesTen Operator Deployment (replicas:1 in your operator.yaml file).