How to resolve Prometheus Error 'role missing (one of: pod, service, endpoints, node)' How to resolve Prometheus Error 'role missing (one of: pod, service, endpoints, node)' kubernetes kubernetes

How to resolve Prometheus Error 'role missing (one of: pod, service, endpoints, node)'


kubernetes_sd_configs is a list of configs, styled as block sequence in YAML terms.

Now, your list of configs looks like this:

- role: endpoints- api_server: localhost:3000

So you're defining two configs, and only the first one of them has a role. This is why you get the error. Most probably, you want to create only one config with role and api_server configured. Drop the second - so that the api_server belongs to the first config:

- role: endpoints  api_server: localhost:3000