Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upMonitoring kubernetes with prometheus from outside of k8s cluster. #4633
Comments
This comment has been minimized.
This comment has been minimized.
|
There is some discussion here: https://stackoverflow.com/questions/41845307/prometheus-cannot-export-metrics-from-connected-kubernetes-cluster/47643005 |
This comment has been minimized.
This comment has been minimized.
|
In this issue there is a comment of how to get cadvisor stats into prometheus - works from external prometheus. If I combine this with kube-state-metrics, then I have what is needed.
Current configuration is:
It would be nice to use kubernetes_sd_configs to get the cadvisor nodes. |
This comment has been minimized.
This comment has been minimized.
pulord
commented
Nov 1, 2018
but the solution can't use kubernetes_sd_configs, and can't service dicover . if you want to add new node to cluster, you must config new target (user static_configs) again. |
This comment has been minimized.
This comment has been minimized.
|
You can set up k8s SD for nodes and using relabeling access the cAdvisor data via kubernetes API proxy. - job_name: kubernetes-cadvisor
scrape_interval: 30s
scrape_timeout: 10s
metrics_path: /metrics
scheme: https
kubernetes_sd_configs:
- api_server: <URL to you k8s API>
role: node
tls_config:
ca_file: ca.pem
cert_file: cert.pem
key_file: kay.pem
insecure_skip_verify: false
tls_config:
ca_file: ca.pem
cert_file: cert.pem
key_file: kay.pem
insecure_skip_verify: false
relabel_configs:
- separator: ;
regex: __meta_kubernetes_node_label_(.+)
replacement: $1
action: labelmap
- separator: ;
regex: (.*)
target_label: __address__
replacement: <URL to you k8s API>
action: replace
- source_labels: [__meta_kubernetes_node_name]
separator: ;
regex: (.+)
target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor
action: replace |
This comment has been minimized.
This comment has been minimized.
AttwellBrian
commented
Dec 14, 2018
|
@FUSAKLA how do you create these |
This comment has been minimized.
This comment has been minimized.
fanyanming2016
commented
Jan 8, 2019
•
|
@AttwellBrian Are the first and second tls_configs the same? they are same |
This comment has been minimized.
This comment has been minimized.
jenciso
commented
Mar 12, 2019
•
For me, until the kubernetes version 1.10 I used that approach, but in the version 1.13, Kubelet doesn't permit authorization correctly. My kubelet log show me
I think that it is a forward credential problem. Probably I need to use |
This comment has been minimized.
This comment has been minimized.
captn3m0
commented
Mar 13, 2019
If anyone here is doing this: how is the load on api server as a result? I'd rather not have my control plane go down because some metrics were scraped too aggressively. |
This comment has been minimized.
This comment has been minimized.
RahulArora31
commented
Apr 4, 2019
|
I tried the solutions given in the above comment but failed to access it.
Help is appreciated. |
This comment has been minimized.
This comment has been minimized.
RahulArora31
commented
Apr 4, 2019
I used to the keys given in .kube file to generate ca.pem, cert.pem and key.pem |
mardicas commentedSep 19, 2018
•
edited
Proposal
The goal of this ticket is to understand how it would be possible or correct way to run prometheus outside of the k8s cluster being monitored. Or what kind of additonal development this would require.
Background
It is a common practice to not run the monitoring software on the stack that is being monitored.
It is important because during outages/problems with the cluster, prometheus might not be working or accessible, leaving the administrator in the blind while solving issues.
Also the case of having multiple clusters to monitor, but wanting to have a centralized prometheus setup.
Acceptable solutions
#2430
In the end of it there are several users with this issue.
Having the kubernetes interanal network available on the monitoring server is not a desired solution because: