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

Prometheus Adapter Can't connect to prometheus, Getting connection reset by peer error #607

Open
robin-coac opened this issue Sep 5, 2023 · 1 comment
Assignees
Labels
kind/support Categorizes issue or PR as a support question. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@robin-coac
Copy link

Problem Statement

Hi everyone, I had a working custom-autoscaling setup with prometheus adapter. However, for some reason, it's not working suddently. After struggling for two days, I am totally out of ideas.

The required custom metric is scraped by prometheus as visible from Prometheus UI.

But, kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1 gives empty output :

{"kind":"APIResourceList","apiVersion":"v1","groupVersion":"custom.metrics.k8s.io/v1beta1","resources":[]}

This is the error log in prometheus adapter.**

E0905 13:29:57.806549       1 provider.go:229] unable to update list of all metrics: unable to fetch metrics for query "{namespace!=\"\", service!=\"\" }": Get "http://prometheus-server-kube-pro-prometheus.my_ns.svc:9090/api/v1/series?match%5B%5D=%7Bnamespace%21%3D%22%22%2C+service%21%3D%22%22+%7D&start=1693920537.802": read tcp 10.42.1.248:46672->10.43.131.216:9090: read: connection reset by peer

Prometheus server installation

helm upgrade --install -n my_ns prometheus-server prometheus-community/kube-prometheus-stack -f https://raw.githubusercontent.com/kyma-project/examples/main/prometheus/values.yaml --set grafana.enabled=false

Prometheus Adapter installation

helm upgrade --install --namespace my_ns prometheus-adapter prometheus-community/prometheus-adapter -f ./prometheus-adapter-values.yaml

values.yaml for Prometheus Adapter

prometheus:
  url: http://prometheus-server-kube-pro-prometheus.my_ns.svc.cluster.local
  port: 9090
  path: ""

rules:
  default: false 

  custom: 
    - seriesQuery: 'jetstream_stream_total_messages{namespace!="", service!="" }'
      resources:
        overrides:
          namespace: {resource: "namespace"}
          service: {resource: "service"}
      name:
        matches: "jetstream_stream_total_messages"
        as: "jetstream_stream_total_messages" ##
      metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>, stream_name="sample-stream" }) by (<<.GroupBy>>)

Output of kubectl get svc -n my_ns

nats-exporter-prometheus-nats-exporter       ClusterIP   10.43.160.239   <none>        80/TCP                       7h41m
prometheus-server-kube-state-metrics         ClusterIP   10.43.154.79    <none>        8080/TCP                     7h18m
prometheus-server-kube-pro-alertmanager      ClusterIP   10.43.71.250    <none>        9093/TCP,8080/TCP            7h18m
prometheus-server-kube-pro-operator          ClusterIP   10.43.107.51    <none>        443/TCP                      7h18m
prometheus-server-prometheus-node-exporter   ClusterIP   10.43.216.251   <none>        9101/TCP                     7h18m
prometheus-server-kube-pro-prometheus        ClusterIP   10.43.131.216   <none>        9090/TCP,8080/TCP            7h18m
prometheus-operated                          ClusterIP   None            <none>        9090/TCP                     7h18m
prometheus-adapter                           ClusterIP   10.43.133.163   <none>        443/TCP                      120m
@robin-coac robin-coac added the kind/bug Categorizes issue or PR as related to a bug. label Sep 5, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 5, 2023
@dgrisonnet
Copy link
Member

/triage accepted
/remove-kind bug
/kind support
/assign

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. kind/support Categorizes issue or PR as a support question. and removed kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

3 participants