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

Kubernetes discovery #904

Closed
jimmidyson opened this Issue Jul 17, 2015 · 7 comments

Comments

Projects
None yet
4 participants
@jimmidyson
Copy link
Member

jimmidyson commented Jul 17, 2015

Bit of a brain dump while I think about it.... Kubernetes components expose Prometheus metrics for the master, nodes, etcd, etc. Autodiscovery of nodes would mean all nodes & running containers are automatically discovered. Nodes expose Prometheus metrics for all Docker containers that Kubernetes manages. As every resource can be labelled in Kubernetes these labels could be reused as metric labels in Prometheus.

Following on from this, Kubernetes annotations could be used on Kubernetes services to monitor service endpoints.

If you're interested in this I'll try to put in a PR for review as soon as I have something basic working to get feedback?

@grobie

This comment has been minimized.

Copy link
Member

grobie commented Jul 18, 2015

This sounds very interesting to me! I'd be interested to hear how you envision the integration and necessary changes/additions in Prometheus. Happy to take a look at a PR, will read up on interfaces Kubernetes provides so far.

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Jul 18, 2015

We are absolutely interested in this!

@jimmidyson

This comment has been minimized.

Copy link
Member Author

jimmidyson commented Jul 18, 2015

To begin with I'm thinking of just adding kubernetes node discovery. This will be enough to collect container (cgroup) metrics for all containers in the cluster as well as cluster level components. Each resource on kubernetes can be labeled (key/value pairs). Each node can be labeled independently & reusing these node labels as Prometheus target labels makes sense so I'm thinking of adding each node as a separate target group. This will mean each target group will only ever contain 1 target. Is there any performance impact of that compared to using a target group with multiple targets? I don't think targets in the same target group can have different labels can they? Well without relabelling which isn't part of discovery.

@matthiasr

This comment has been minimized.

Copy link
Contributor

matthiasr commented Jul 18, 2015

This sounds great! For pods, it's already kind of possible using DNS and SRV records but from my limited playing with it this only works if the pod is covered by a service.

Once all the bits for monitoring cluster, nodes and pods I think it would be great to have a blessed example configuration/replication controller/prometheus service definition that new kubernetes/Prometheus users can drop in to get started quickly.

@jimmidyson

This comment has been minimized.

Copy link
Member Author

jimmidyson commented Jul 18, 2015

@matthiasr while using DNS is possible for pods that are service endpoints, you won't be able to use the kubernetes labels as metric labels. Once I've added in node metrics, I hope to expand this initial node only functionality to cover kubernetes service endpoints via the kubernetes api. This will enable reusing kubernetes labels in metrics labels. Haven't thought about that too much yet but any ideas most welcome.

Your idea for a blessed config sounds great. Once I have something basically working I'll let you know & perhaps you could help me work out a generic config that will work out of the box for most people. I know kubernetes better than Prometheus so I have a lot to learn here.

@jimmidyson

This comment has been minimized.

Copy link
Member Author

jimmidyson commented Jul 18, 2015

@matthiasr BTW if you wanted to try out a drop in config for kubernetes nodes that uses file config targets & a separate watcher utility to update the targets as changes happen we provide one in fabric8. The kubernetes manifest is available at http://repo1.maven.org/maven2/io/fabric8/jube/images/fabric8/prometheus/2.2.9.1/prometheus-2.2.9.1-kubernetes.json It's this work that I'm trying to convert over to built in Prometheus discovery.

@fabxc fabxc closed this in 923f811 Aug 13, 2015

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

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