Kubernetes - Monitoring and LoggingYou created a ServiceMonitor but Prometheus is not scraping metrics from your service. Which of these is a likely cause?AThe ServiceMonitor selector labels do not match the service labelsBThe Prometheus server is not running on the clusterCThe service port is not exposed in the ServiceMonitor endpointsDAll of the aboveCheck Answer
Step-by-Step SolutionSolution:Step 1: Check label matchingIf ServiceMonitor selector labels don't match service labels, Prometheus won't find the service.Step 2: Verify Prometheus server status and endpoint configPrometheus must be running and the service port must be correctly specified in endpoints to scrape metrics.Final Answer:All of the above -> Option DQuick Check:Any mismatch or missing config stops scraping [OK]Quick Trick: Check labels, server status, and endpoints all match [OK]Common Mistakes:Only checking one cause and ignoring othersAssuming Prometheus always runs by defaultForgetting to expose correct port in ServiceMonitor
Master "Monitoring and Logging" in Kubernetes9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Kubernetes Quizzes Advanced Deployment Patterns - Progressive delivery concept - Quiz 11easy Advanced Deployment Patterns - Feature flags in Kubernetes - Quiz 12easy Monitoring and Logging - Container logging architecture - Quiz 5medium Monitoring and Logging - Grafana for visualization - Quiz 1easy Operators and Custom Resources - OperatorHub for community operators - Quiz 11easy Production Best Practices - Priority classes for critical workloads - Quiz 6medium RBAC and Security - Roles and ClusterRoles - Quiz 7medium Service Mesh - Observability with service mesh - Quiz 1easy Service Mesh - Istio overview - Quiz 9hard Troubleshooting - Debugging service connectivity - Quiz 9hard