Enabling the metrics endpoint
Elastic Cloud on Kubernetes extends Kubernetes orchestration capabilities to allow you to deploy and manage components of the Elastic Stack. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
ECK
Generally available
The metrics endpoint is not enabled by default. To enable the metrics endpoint, follow the instructions in the next sections depending on whether you installed ECK through the Helm chart or the manifests.
If you installed ECK through the Helm chart commands listed in Install ECK using the Helm chart, you can set config.metrics.port to a value greater than 0 in your values file and the metrics endpoint will be enabled.
If you installed ECK using the manifests using the commands listed in Install ECK using the YAML manifests, some additional changes will be required to enable the metrics endpoint.
Enable the metrics endpoint in the
ConfigMap.Shell cat <<EOF | kubectl apply -f - kind: ConfigMap apiVersion: v1 metadata: name: elastic-operator namespace: elastic-system data: eck.yaml: |- log-verbosity: 0 metrics-port: 8080 metrics-host: 0.0.0.0 container-registry: docker.elastic.co max-concurrent-reconciles: 3 ca-cert-validity: 8760h ca-cert-rotate-before: 24h cert-validity: 8760h cert-rotate-before: 24h disable-config-watch: false exposed-node-labels: [topology.kubernetes.io/.*,failure-domain.beta.kubernetes.io/.*] set-default-security-context: auto-detect kube-client-timeout: 60s elasticsearch-client-timeout: 180s disable-telemetry: false distribution-channel: all-in-one validate-storage-class: true enable-webhook: true webhook-name: elastic-webhook.k8s.elastic.co webhook-port: 9443 operator-namespace: elastic-system enable-leader-election: true elasticsearch-observation-interval: 10s ubi-only: false EOFPatch the
StatefulSetto expose the metrics port.Shell kubectl patch sts -n elastic-system elastic-operator --patch-file=/dev/stdin <<-EOF spec: template: spec: containers: - name: manager ports: - containerPort: 9443 name: https-webhook protocol: TCP - containerPort: 8080 protocol: TCP name: metrics EOFThe ECK operator will be recreated after applying the patch.
If using the Prometheus operator, install a
PodMonitorto allow Prometheus to scrape the metrics endpoint.Shell cat <<EOF | kubectl apply -f - apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: name: elastic-operator namespace: elastic-system labels: control-plane: elastic-operator app.kubernetes.io/component: metrics spec: podMetricsEndpoints: - port: metrics path: /metrics interval: 1m scrapeTimeout: 30s namespaceSelector: matchNames: - elastic-system selector: matchLabels: control-plane: elastic-operator EOF
- If you're using ECK 2.16 or earlier, secure the metrics endpoint.
- If you're using Prometheus, configure Prometheus to be able to collect ECK metrics.