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

Question:
You have configured the Elastic Kubernetes Service on AWS and have deployed Node Exporter to each of the hosts and configured it to be managed by systemd.
Which of the following service discovery methods should you use to configure a Prometheus scrape for Node Exporter?

  1. kubernetes_sd_configs
  2. static_sd_configs
  3. file_sd_configs
  4. ec2_sd_configs
Answer:
D - correct option.
A - Since Node Exporter is being managed by systemd and not by a Kubernetes DaemonSet, there will be no Node Exporter pods to discover and thus kubernetes_sd_configs will not be effective.
B - static_sd_configs is incorrect as Kubernetes nodes are dynamic. Sometimes nodes will be added and other times nodes will be removed. In each of these cases, static target configuration would have to be manually updated. Thus, leveraging the built-in ec2_sd_configs is a better option.
C - file_sd_configs is incorrect as ec2_sd_configs is a better, built-in choice for dynamically identifying AWS instances to scrape.
More info at ec2_sd_configs