PCA (Prometheus Certified Associate) sample exam question with answer 103

Question:
What method of service discovery is BEST for identifying Kubernetes pods to scrape?

  1. docker_sd_configs
  2. file_sd_configs
  3. static_configs
  4. kubernetes_sd_configs
Answer:
D - is the correct answer. More info at kubernetes_sd_config
A - is incorrect. While Kubernetes used to support the Docker container engine, it no longer does. Additionally, kubernetes_sd_configs allows discovery of pods while docker_sd_configs only allows discovery of containers
B - is incorrect. While file_sd_configs could be used with some custom code to identify Kubernetes pods, it is significantly easier to just use the built-in kubernetes_sd_configs
C - s incorrect as static configuration of targets does not provide automatic discovery