role attribute belongs to either
openstack_sd_config. If you want this configuration to monitor your Kubernetes nodes, yes you need to change the role to “node”.
The other possibilities are “service”, “pod”, “endpoint” and “ingress”, which are all Kubernetes objects hosted on the nodes and you may want to monitor them too eventually.
The relabel config you pasted is a good idea. It creates an “address” label with just the address part from the “instance” label (without the colon and port number).
The Kubernetes service discovery returns this meta-label for nodes:
__meta_kubernetes_node_name. You can use it in a relabel_config too.
- role: node
- source_labels: __meta_kubernetes_node_name
This may also help you: https://github.com/prometheus/prometheus/blob/release-2.4/documentation/examples/prometheus-kubernetes.yml
Reference for kubernetes_sd_config: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#<kubernetes_sd_config>