Add relabelings on servicemonitor created via k8ssandra-operator 1.4

We have installed cassandra DB using CRD K8ssandraCluster managed by k8ssandra-operator 1.4 version. I would like to add relabelings on the servicemonitor and also add labels/annotations on the pods created via the k8ssandra-operator

Hi @Kishore_Gunda,

in order to add labels to the ServiceMonitors, use .spec.cassandra.telemetry.prometheus.commonLabels.

If you want to add labels to the pods, check .spec.cassandra.metadata.

Hi @alexander ,
Thanks for the response. We are using the crd k8ssandra-operator 1.4 we plan to upgrade to latest version in next quarter.

In the current version of 1.4 we have tried both these options but labels are not populated on servicemonitor. Additionally, does the k8ssandra-operator allow to create relabelings on servicemonitor so that we add the new target label while sending feed to prometheus exporter using servicemonitor
.spec.cassandra.datacenters[index].telemetry.prometheus

.spec.cassandra.telemetry.prometheus

That’s only possible since v1.5, using the new metrics endpoint that replaces MCAC.
You can add you own relabelings through .spec.cassandra.telemetry.cassandra.relabels, but they will not be added to the service monitor. They will be processed by the new metrics agent instead, which allows to have a consistent behavior whether your using Vector or ServiceMonitors to expose the metrics.

In the current version of 1.4 we have tried both these options but labels are not populated on servicemonitor.

Hmmmm, that’s annoying. I’m eager to know if you have the same issue with recent versions.

Thanks Alexander for the response. Labels are added in latest version of K8ssandra-operator. We will test completely from our end and see if everything is working as expected.