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 upAfter deploy prometheus, it shows x509: certificate is valid for apiserver, not kubernetes.default.svc #2088
Comments
fabxc
added
the
kind/question
label
Oct 17, 2016
zybjcdl
changed the title
After deploy prometheus, it can't show x509: certificate is valid for apiserver, not kubernetes.default.svc
After deploy prometheus, it shows x509: certificate is valid for apiserver, not kubernetes.default.svc
Oct 17, 2016
This comment has been minimized.
This comment has been minimized.
|
BTW: |
This comment has been minimized.
This comment has been minimized.
|
Your certificates doesn't contain the default CN or SAN (recommended by kubernetes) of
2 is probably your best bet I think. |
This comment has been minimized.
This comment has been minimized.
|
@jimmidyson Thank you for your response. My kubernetes dashboard is https://9.30.245.34/ui , the private ip is 172.20.154.140 How could I change the config file to access this api? I tried to change the config as below: But it reports: And also, I checked, in prometheus container, the /var/run/secrets/kubernetes.io/serviceaccount/ca.crt |
This comment has been minimized.
This comment has been minimized.
|
Could you format the config in the issue by wrapping in ``` before & after the contents? YAML is picky on indentation so without that formatting I can't see what you might have got wrong. |
This comment has been minimized.
This comment has been minimized.
|
@jimmidyson Here is the before & after. After: |
This comment has been minimized.
This comment has been minimized.
|
Again, can you please format your config by wrapping in ```? It looks OK so I've had a look in the retrieval code & it looks like To work around, try removing the kubernetes_sd_configs:
- api_servers:
- 'https://172.20.154.140'
role: apiserver
tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
basic_auth:
username: admin
password: passwd |
This comment has been minimized.
This comment has been minimized.
|
@jimmidyson here is my config:
Also, I checked ,my apiserver is running with following parameters:
In prometheus container, the /var/run/secrets/kubernetes.io/serviceaccount/ca.crt |
This comment has been minimized.
This comment has been minimized.
|
@jimmidyson
I still have 2 questions:
Here is my whole config:
|
This comment has been minimized.
This comment has been minimized.
|
I'm presuming this is addressed by now. |
brian-brazil
closed this
Feb 13, 2017
This comment has been minimized.
This comment has been minimized.
ghost
commented
Nov 22, 2018
•
|
i am facing same issue,, my prometheus is outside of k8s cluster..
|
This comment has been minimized.
This comment has been minimized.
strongit
commented
Apr 1, 2019
my prometheus is outside of k8s cluster too,and ,it shows
remote_write:
scrape_configs:
|

zybjcdl commentedOct 17, 2016
•
edited by brian-brazil
I deploy prometheus on a k8s cluster, but it shows
kubernetes-cluster Endpoint State Labels Last Scrape Error
https://kubernetes.default.svc:443/metrics DOWN none 3.153s ago Get https://kubernetes.default.svc:443/metrics: x509: certificate is valid for apiserver, not kubernetes.default.svc
And also, no kubernetes-nodes shows up.
Here is my prometheus.yml: