Skip to main content
Loading
Version: Operator 2.5.0

Monitoring Aerospike Clusters on Kubernetes

The Aerospike Monitoring Stack is a useful way to enable monitoring and alerts for Aerospike clusters deployed by the Aerospike Kubernetes Operator.

Add Aerospike Prometheus Exporter Sidecar

The following example assumes you have no security enabled, as in a testing or sandbox environment.

danger

We recommend you enable security for a production environment.

spec:
.
.
.

podSpec:
sidecars:
- name: aerospike-prometheus-exporter
image: aerospike/aerospike-prometheus-exporter:1.9.0
ports:
- containerPort: 9145
name: exporter

.
.
.

The next example describes passing additional parameters to an exporter sidecar.

tip

All supported parameters are listed in the Aerospike Prometheus Exporter repository in the docker-entrypoint.sh file.

Set your environmental variables as shown here:

spec:
.
.
.

podSpec:
multiPodPerHost: true
sidecars:
- name: aerospike-prometheus-exporter
image: aerospike/aerospike-prometheus-exporter:1.9.0
env:
# - name: "BASIC_AUTH_USERNAME"
# value: "jdoe"
# - name: "BASIC_AUTH_PASSWORD"
# value: "jdoe123"
- name: "AS_AUTH_USER"
value: "exporter"
- name: "AS_AUTH_PASSWORD"
value: "exporter123"
- name: "AS_AUTH_MODE"
value: "internal"
ports:
- containerPort: 9145
name: exporter

.
.
.

Create or update your clusters after you add the Prometheus exporter sidecar.

Prometheus Configuration

Configure Prometheus to add exporter endpoints as scrape targets.

If Prometheus is also running on Kubernetes, you can configure it to extract exporter targets from the Kubernetes API.

In the following example, Prometheus discovers and adds exporter targets in the default namespace which has endpoint port name of aerospike-prometheus-exporter.

scrape_configs:
- job_name: 'aerospike'

kubernetes_sd_configs:
- role: endpoints
namespaces:
names:
- default
relabel_configs:
- source_labels: [__meta_kubernetes_pod_container_port_name]
separator: ;
regex: exporter
replacement: $1
action: keep

See Aerospike Monitoring Stack documentation for more information on installing and configuring the Aerospike Monitoring Stack.

Dashboards

To view the metrics, we recommend you import our pre-made Grafana dashboards from the Aerospike Monitoring GitHub Repo.

Example

This example demonstrates how to use the Aerospike Monitoring Stack to monitor Aerospike clusters deployed by the Aerospike Kubernetes Operator.

Deploy the Aerospike Kubernetes Operator using OLM as described in the Getting Started section.

Create a Kubernetes Secret aerospike-license to store the Aerospike license feature key file.

kubectl create secret generic aerospike-license --from-file=[path to the features.conf-file]

To deploy an Aerospike cluster with an Aerospike Prometheus Exporter sidecar, add the following to the podSpec section of the cluster's CR file:

podSpec:
multiPodPerHost: true
sidecars:
- name: aerospike-prometheus-exporter
image: aerospike/aerospike-prometheus-exporter:1.9.0
ports:
- containerPort: 9145
name: exporter

Use kubectl to apply the change.

kubectl apply -f aerospike-cluster.yaml

Deploy Prometheus-Grafana Stack using aerospike-monitoring-stack.yaml.

kubectl apply -f aerospike-monitoring-stack.yaml

Connect to the Grafana dashboard.

kubectl port-forward service/aerospike-monitoring-stack-grafana 3000:80

Open a browser window and go to localhost:3000. Log into Grafana with username admin and password admin.

To view the metrics, we recommend you import dashboards from the Aerospike Monitoring GitHub Repo.