Monitor Aerospike Kubernetes Operator
This page describes how to monitor Aerospike Kubernetes Operator.
Overview
Aerospike Kubernetes Operator (AKO) exposes metrics on the /metrics
endpoint.
This endpoint is protected by kube-rbac-proxy
, so Prometheus must have the required permissions to scrape these metrics.
Configure system to scrape AKO metrics
To collect metrics, configure Prometheus to scrape the /metrics
endpoint.
You can do this manually by installing and configuring the Prometheus Operator from GitHub, or by using the pre-built AKO monitoring stack.
Using Prometheus Operator
See Install Prometheus Operator to install the kube-prometheus-stack
, which includes the Prometheus Operator and Grafana.
AKO uses a Kubernetes Service labeled control-plane: controller-manager
to make its metrics available for scraping.
The Prometheus Operator uses ServiceMonitor
resources to learn which pods to scrape for endpoints and how they should be scraped.
Create a ServiceMonitor
resource to configure Prometheus to find this Kubernetes Service and monitor it at regular intervals to scrape the AKO /metrics
endpoint.
Create a file named
service-monitor.yaml
. In this example, TLS certification is disabled for a testing environment.apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
name: aerospike-operator-controller-manager-metrics-monitor
spec:
endpoints:
- path: /metrics
interval: 15s # Scraping interval
port: https
scheme: https
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
tlsConfig:
insecureSkipVerify: true # Disables TLS certificate verification
selector:
matchLabels:
control-plane: controller-manager # AKO metric service labelVerify that the Prometheus deployment is configured to select the AKO
ServiceMonitor
usingserviceMonitorSelector
. Ensure that theserviceMonitorSelector
includes the labels used in theServiceMonitor
.kubectl -n PROMETHEUS_NAMESPACE get prometheus PROMETHEUS_CR_NAME -o yaml
Apply the
ServiceMonitor
resource:kubectl apply -f service-monitor.yaml -n AKO_NAMESPACE
For the full list of metrics that AKO makes available for scraping, see Metrics.
Using Aerospike Kubernetes Operator Monitoring Stack
If you have cloned the AKO repository, you can apply the monitoring configurations in one step with kubectl
:
kubectl apply -k config/monitoring