Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the clusterIP from service via kubernetes_sd meta label #3110

Closed
talset opened this Issue Aug 24, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@talset
Copy link

talset commented Aug 24, 2017

Environment

Kubernetes v1.5.4+coreos.0"

  • Prometheus version:

quay.io/prometheus/prometheus:v2.0.0-beta.0

  • Prometheus configuration file:
    - job_name: 'kube-state-metrics'
      kubernetes_sd_configs:
      - role: service

      relabel_configs:
      - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_label_k8s_app]
        action: keep
        regex: prometheus;kube-state-metrics

Question

When I use role: service it use by default the svc.Name+"."+svc.Namespace+".svc" (https://github.com/prometheus/prometheus/blob/master/discovery/kubernetes/service.go#L153) as address. Since we are not using skydns in our k8s cluster we would like to use the service ip / ClusterIP directly.

As the same way you get the port from spec (https://github.com/prometheus/prometheus/blob/master/discovery/kubernetes/service.go#L152), is it possible to get the clusterIP (when it is present) and export it as metalabel __meta_kubernetes_service_clusterIP to prometheus ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.