elasticsearch_exporter icon indicating copy to clipboard operation
elasticsearch_exporter copied to clipboard

ServiceMonitor for elastic cluster with operator

Open therus000 opened this issue 3 years ago • 2 comments

Good day i already installed prometheus exporter plugin while deploy and elastic with operator. now i stuck on how deploy a servicemonitor to export target to prometheus ` apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: elastic-cluster #namespace: monitoring spec: endpoints:

  • interval: 20s path: "/_prometheus/metrics" port: https scheme: https tlsConfig: insecureSkipVerify: true basicAuth: password: name: secrets-values key: basic_auth_password username:
    name: secrets-values key: basic_auth_user
    namespaceSelector: matchNames:
  • elastic-cluster selector: matchLabels: common.k8s.elastic.co/type: elasticsearch elasticsearch.k8s.elastic.co/cluster-name: elastic-cluster`

maybe someone tell how to deploy the password and the user of elastic to service monitor? dev tool show that plugin installed elastic-cluster-es-node-1 prometheus-exporter 7.17.0.0 elastic-cluster-es-coordinator-0 prometheus-exporter 7.17.0.0 elastic-cluster-es-node-0 prometheus-exporter 7.17.0.0 elastic-cluster-es-node-2 prometheus-exporter 7.17.0.0 elastic-cluster-es-coordinator-1 prometheus-exporter 7.17.0.0

therus000 avatar May 12 '22 10:05 therus000

Did you create "secrets-values" already ? you need create "secrets-values" first

be like

apiVersion: v1
kind: Secret
metadata:
  name: secrets-values
data:
  username: $(echo -n "${USERNAME}" | base64)
  password: $(echo -n "${PASSWORD}" | base64)

aaron791109 avatar Oct 22 '22 15:10 aaron791109

The service monitor does not need the secrets for elasticsearch. The service monitor is for prometheus to find the exporter which will not have the same auth as elasticsearch. You want the deployment for the elasticsearch exporter to have the secrets for the elasticsearch cluster plugged into the environment variables.

sysadmind avatar Nov 01 '22 00:11 sysadmind