Exposing metric path in container level

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: 1.
Cloud being used: AWS

Is there anyway to expose the container metric path as an annotation within the pod? When we use kubernets_sd_config in prometheus, with pod as role, we get lot of container level annotations like this.


I would like to get one more annotation like the one below.


This is currently unavailable now. I understand that Kubernetes may cannot understand in what path the metrics are exposing from a container. But it would be helpful if we could annotate for a container like we do it with kubernetes service.

This is helpful when we have multiple containers in a pod and and all are exposing metrics in a specific path. I know this can be achievable through multiple services but I would like to avoid deploying multiple services for a single pod, instead of if we have metric_path annotation with each container we can make use of it with pod service discovery in prometheus(which discovers all containers in a pod) with it’s own metric_path.



You can annotate your pods with any information that you want/need: Annotations | Kubernetes

If I am not mistaken, annotations are defined at pod level; so if you have different paths for metric in each container, you can add one annotation for each container:


Hope that it helps!

Best regards,