How can I scrape Prometheus metrics from the Okteto Insights using the Prometheus Operator?
To scrape Prometheus metrics from Okteto Insights using Prometheus Operator, follow these steps:
-
Ensure prerequisites:
- Prometheus Operator is installed in the cluster, and its version is higher than 0.65.1.
- The CRD for
ScrapeConfig
is correctly installed in the cluster.
-
Apply the following
ScrapeConfig
manifest in theokteto
namespace:apiVersion: monitoring.coreos.com/v1alpha1 kind: ScrapeConfig metadata: name: okteto namespace: okteto labels: instance: okteto spec: staticConfigs: - targets: - okteto.yourinstancedomain.com:443 scheme: HTTPS authorization: credentials: key: bearer name: okteto-insights
Replace
okteto.yourinstancedomain.com
with your Okteto instance address. Refer to the following documentation for getting this value:If you customized your Helm release
insights.bearerSecret
configuration, replacespec.authorization.credentials
accordingly. Refer to the following documentation for more information: -
Label the
okteto
namespace:kubectl label ns okteto prometheus-operator=okteto-insights
-
Update your Prometheus Operator instance with the following sections:
spec: scrapeConfigSelector: matchLabels: instance: okteto scrapeConfigNamespaceSelector: matchLabels: prometheus-operator: okteto-insights
These steps will configure your Prometheus Operator to scrape metrics from Okteto Insights.