0

A service pod is running with Istio sidecar container and is MTLS enabled. How do we define a service monitor to scrape metrics from this service ? Do we need to update the Prometheus server for the same ?

My Pod monitor looks like as shown below:

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: mymonitor
  labels:
    release: podwithistiosidecar
spec:
  selector:
    matchLabels:
      app: podwithistiosidecar
  podMetricsEndpoints:
  - port: "metrics"
    path: "/metrics"
    scheme: https

The error I was getting was: Get "https://192.168.3.29:9090/metrics": tls: failed to verify certificate: x509: cannot validate certificate for 192.168.3.29 because it doesn't contain any IP SANs

Then I tried with the below configuration:

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: mymonitor
  labels:
    release: podwithistiosidecar
spec:
  selector:
    matchLabels:
      app: podwithistiosidecar
  podMetricsEndpoints:
  - port: "metrics"
    path: "/metrics"
    scheme: https
    tlsConfig:
      insecureSkipVerify: true

And below error was coming with this:

Get "https://192.168.3.29:9090/metrics": write tcp 192.168.92.182:48408->192.168.3.29:9090: write: broken pipe

1 Answer 1

0

You may define service monitor to scrape metrics from a pod running with an Istio sidecar and MTLS enabled, you can try the following YAML file:

apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
  name: mysvcmonitor
  labels:
    release: podwithistiosidecar
spec:
  selector:
    matchLabels:
      app: podwithistiosidecar
  podMetricsEndpoints:
  - port: "metrics"
    path: "/metrics"
    scheme: https
    tlsConfig:
      caFile: /etc/prom-certs/root-cert.pem
      certFile: /etc/prom-certs/cert-chain.pem
      keyFile: /etc/prom-certs/key.pem
      insecureSkipVerify: true

Aside from this, you can look into this following list for additional example that might be useful to you:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .