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 Failed to list *v1.Endpoints: Get https://xxxx:6443/api/v1/endpoints?limit=500&resourceVersion=0: x509: certificate signed by unknown authority" #4678

Closed
xiaoxi1989 opened this Issue Sep 29, 2018 · 5 comments

Comments

Projects
None yet
4 participants
@xiaoxi1989
Copy link

xiaoxi1989 commented Sep 29, 2018

Bug Report

What did you do?
configuration in outside kubernetes cluster

- job_name: 'kubernetes-service-endpoints'

 
  kubernetes_sd_configs:
  - role: endpoints
    api_server: https://xxxx(outside cluster):6443
    tls_config:
      insecure_skip_verify: true
    bearer_token: xxxx
  relabel_configs:
  - action: labelmap
    regex: __meta_kubernetes_service_label_(.+)
  - source_labels: [__meta_kubernetes_namespace]
    action: replace
    target_label: kubernetes_namespace
  - source_labels: [__meta_kubernetes_service_name]
    action: replace
    target_label: kubernetes_name

What did you expect to see?
it can get entpoints info.

What did you see instead? Under which circumstances?

level=error ts=2018-09-29T12:31:02.230105551Z caller=main.go:234 component=k8s_client_runtime err="github.com/prometheus/prometheus/discovery/kubernetes/kubernetes.go:286: Failed to list *v1.Endpoints: Get https://xxxxxx:6443/api/v1/endpoints?limit=500&resourceVersion=0: x509: certificate signed by unknown authority"

Environment

  • System information:
    Darwin 17.3.0 x86_64

  • Prometheus version:
    prometheus, version 2.4.2 (branch: HEAD, revision: c305ffa)
    build user: root@dcde2b74c858
    build date: 20180921-07:27:12
    go version: go1.10.3

@xiaoxi1989

This comment has been minimized.

Copy link
Author

xiaoxi1989 commented Sep 29, 2018

it work:
curl -k -H "Authorization: Bearer $(cat ../kubernetes/token)" 'https://xxx:6443/api/v1/endpoints?limit=500&resourceVersion=0'

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Oct 1, 2018

I've tested on my local environment and it works fine with insecure_skip_verify: true. Can you paste the full configuration as displayed in the Prometheus UI (Status > Configuration menu)?

@trnl

This comment has been minimized.

Copy link

trnl commented Oct 4, 2018

If cluster is with RBAC, do:

        tls_config:
          ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
          insecure_skip_verify: true
        bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
@vivekj11

This comment has been minimized.

Copy link

vivekj11 commented Mar 3, 2019

I was getting the same error even after mentioning insecure_skip_verify: true.
Though it worked for me in this way

kubernetes_sd_configs:
- api_server: https://<ip>:6443
  role: node
  bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  tls_config:
    insecure_skip_verify: true

By specifying inseucre_skip_verfity as a part of api_server context

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Mar 4, 2019

Closing due to inactivity.

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.