Every pod created by aerospike-operator
features a sidecar container running asprom
[1]. This container is responsible for exporting metrics from the current Aerospike node in Prometheus format.
asprom
listens on :9145
and exposes a /metrics
endpoint that Prometheus can scrape. One can easily test the endpoint by port-forwarding to a running pod:
$ kubectl port-forward pod/as-cluster-0-0 9145:9145
Forwarding from 127.0.0.1:9145 -> 9145
Forwarding from [::1]:9145 -> 9145
At this point, a request to http://127.0.0.1:9145/metrics
will output the metrics for the as-cluster-0-0
pod:
$ curl http://127.0.0.1:9145/metrics
# HELP aerospike_node_batch_error batch error
# TYPE aerospike_node_batch_error gauge
aerospike_node_batch_error 0
# HELP aerospike_node_batch_index_complete batch index complete
# TYPE aerospike_node_batch_index_complete gauge
aerospike_node_batch_index_complete 0
(...)
Pods in a given Aerospike cluster can be discovered by Prometheus using the headless service for the cluster created by aerospike-operator
. For further details one should refer to the Prometheus configuration guide.