Bird
0
0

After deploying a ServiceMonitor, Prometheus is not scraping your application's metrics. Which of the following is the most probable reason?

medium📝 Troubleshoot Q6 of 15
Kubernetes - Monitoring and Logging
After deploying a ServiceMonitor, Prometheus is not scraping your application's metrics. Which of the following is the most probable reason?
AThe application is exposing metrics on a non-standard port that Prometheus cannot detect
BPrometheus does not support scraping metrics from Kubernetes services
CThe ServiceMonitor's label selector does not match the labels on the target service
DThe ServiceMonitor resource is missing the 'apiVersion' field
Step-by-Step Solution
Solution:
  1. Step 1: Check ServiceMonitor configuration

    ServiceMonitor uses label selectors to identify which services to scrape.
  2. Step 2: Identify mismatch issue

    If the selector labels do not match the service labels, Prometheus will not scrape metrics.
  3. Step 3: Evaluate other options

    Prometheus does not support scraping metrics from Kubernetes services is incorrect because Prometheus supports scraping Kubernetes services. The application is exposing metrics on a non-standard port that Prometheus cannot detect is less likely if the port is correctly specified in ServiceMonitor. The ServiceMonitor resource is missing the 'apiVersion' field would cause resource creation failure.
  4. Final Answer:

    The ServiceMonitor's label selector does not match the labels on the target service -> Option C
  5. Quick Check:

    Label selectors must match service labels for scraping [OK]
Quick Trick: Label selectors must match target service labels [OK]
Common Mistakes:
  • Ignoring label selector mismatches
  • Assuming Prometheus cannot scrape services
  • Overlooking port configuration in ServiceMonitor

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes