Giter Club home page Giter Club logo

Comments (7)

Haleygo avatar Haleygo commented on May 28, 2024

Hello,
From the error logs, the caFile provided for those scrape jobs are invalid, could you check if you mounted the right files to vmagent?

2024-04-10T10:28:07.401Z warn VictoriaMetrics/lib/promscrape/scrapework.go:382 cannot scrape target "https://172.16.0.74:2379/metrics" ({endpoint="http-metrics",instance="172.16.0.74:2379",job="kube-etcd",namespace="kube-system",pod="etcd-sealos-run-master0000",service="victoria-metrics-k8s-stack-kube-etcd"}) 1 out of 1 times during -promscrape.suppressScrapeErrorsDelay=0s; the last error: cannot perform request to "https://172.16.0.74:2379/metrics": Get "https://172.16.0.74:2379/metrics": tls: failed to verify certificate: x509: certificate signed by unknown authority
2024-04-10T10:28:09.071Z warn VictoriaMetrics/lib/promscrape/scrapework.go:382 cannot scrape target "https://172.16.0.74:10257/metrics" ({endpoint="http-metrics",instance="172.16.0.74:10257",job="kube-controller-manager",namespace="kube-system",pod="kube-controller-manager-sealos-run-master0000",service="victoria-metrics-k8s-stack-kube-controller-manager"}) 1 out of 1 times during -promscrape.suppressScrapeErrorsDelay=0s; the last error: cannot perform request to "https://172.16.0.74:10257/metrics": Get "https://172.16.0.74:10257/metrics": tls: failed to verify certificate: x509: certificate is valid for localhost, localhost, not kubernetes

from victoriametrics.

bxy4543 avatar bxy4543 commented on May 28, 2024
kubectl exec -n vm -it vmagent-victoria-metrics-k8s-stack-554cd7779b-6ch5n -c vmagent -- sh
/ # ls -LR /etc/vmagent*
/etc/vmagent:
config      config_out

/etc/vmagent/config:
vmagent.yaml.gz

/etc/vmagent/config_out:
vmagent.env.yaml

/etc/vmagent-tls:
certs

/etc/vmagent-tls/certs:

is it here? It looks like the tls certificate is empty.

from victoriametrics.

plutocholia avatar plutocholia commented on May 28, 2024
kubectl exec -n vm -it vmagent-victoria-metrics-k8s-stack-554cd7779b-6ch5n -c vmagent -- sh
/ # ls -LR /etc/vmagent*
/etc/vmagent:
config      config_out

/etc/vmagent/config:
vmagent.yaml.gz

/etc/vmagent/config_out:
vmagent.env.yaml

/etc/vmagent-tls:
certs

/etc/vmagent-tls/certs:

is it here? It looks like the tls certificate is empty.

I think she meant /var/run/secrets/kubernetes.io/serviceaccount/ca.crt which is provided in the spec.endpoints.[*].tlsConfig scope of VMServiceScrape resource.

from victoriametrics.

bxy4543 avatar bxy4543 commented on May 28, 2024
kubectl describe clusterrole monitoring:vmagent-cluster-access-victoria-metrics-k8s-stack
Name:         monitoring:vmagent-cluster-access-victoria-metrics-k8s-stack
Labels:       app.kubernetes.io/component=monitoring
              app.kubernetes.io/instance=victoria-metrics-k8s-stack
              app.kubernetes.io/managed-by=Helm
              app.kubernetes.io/name=vmagent
              app.kubernetes.io/version=v1.96.0
              helm.sh/chart=victoria-metrics-k8s-stack-0.18.11
              managed-by=vm-operator
Annotations:  meta.helm.sh/release-name: victoria-metrics-k8s-stack
              meta.helm.sh/release-namespace: vm
PolicyRule:
  Resources                            Non-Resource URLs     Resource Names  Verbs
  ---------                            -----------------     --------------  -----
  configmaps                           []                    []              [get list watch]
  endpoints                            []                    []              [get list watch]
  namespaces                           []                    []              [get list watch]
  nodes/metrics                        []                    []              [get list watch]
  nodes/proxy                          []                    []              [get list watch]
  nodes                                []                    []              [get list watch]
  pods                                 []                    []              [get list watch]
  secrets                              []                    []              [get list watch]
  services                             []                    []              [get list watch]
  endpointslices.discovery.k8s.io      []                    []              [get list watch]
  ingresses.extensions                 []                    []              [get list watch]
  ingresses.networking.k8s.io          []                    []              [get list watch]
                                       [/metrics/resources]  []              [get]
                                       [/metrics]            []              [get]
  registry.image.openshift.io/metrics  []                    []              [get]
  routers.image.openshift.io/metrics   []                    []              [get]
  registry.route.openshift.io/metrics  []                    []              [get]
  routers.route.openshift.io/metrics   []                    []              [get]
                                       [/metrics/resources]  []              [list]
                                       [/metrics]            []              [list]
                                       [/metrics/resources]  []              [watch]
                                       [/metrics]            []              [watch]

Yes, thanks for the reply, it is a vm scrape job automatically created by installing vm stack through helm. Why is there tls: bad certificate, and how can I fix this problem now?

from victoriametrics.

Haleygo avatar Haleygo commented on May 28, 2024

Why is there tls: bad certificate, and how can I fix this problem now?

Because this cert is invaild for etcd, /var/run/secrets/kubernetes.io/serviceaccount/ca.crt is just the default path of SA token, it's just there to be an example i guess(maybe we should remove it if it caused misunderstanding)).
If you want to access etcd using https, you need to create etcd client certificates, mount them to vmagent and change the cert path in VMServiceScrape here:

spec:
  endpoints:
  - port: http-metrics
    scheme: https
    tlsConfig:
      caFile: <you-etcd-cert-path>

See examples here and here.

from victoriametrics.

bxy4543 avatar bxy4543 commented on May 28, 2024

Thanks for the reply, I'll try creating and mounting the certificate manually. @Haleygo

from victoriametrics.

bxy4543 avatar bxy4543 commented on May 28, 2024

it's just there to be an example i guess(maybe we should remove it if it caused misunderstanding)).

Indeed, this caused some misunderstandings for me.

from victoriametrics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.