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

ServiceMonitor.monitoring.coreos.com "prometheus-exporter" is invalid: spec.endpoints: Required value #390

Closed
dabo-devconsole opened this issue Feb 7, 2024 · 12 comments · Fixed by #482
Labels
bug Something isn't working

Comments

@dabo-devconsole
Copy link

dabo-devconsole commented Feb 7, 2024

Description

Helm installation fails to deploy the prometheus-exporter ServiceMonitor.

Environment

OS: Ubuntu 22.04 LTS
Version: 3.0.3

Steps To Reproduce

  1. --set "capabilities.prometheusExporter=enable" or set value in values.yaml
  2. helm install ...
  3. install all, but prometheus-exporter
  4. error: Error: INSTALL FAILED: failed to create resource: ServiceMonitor.monitoring.coreos.com "prometheus-exporter" is invalid: spec.endpoints: Required value

Expected behavior

ServiceMonitor is created

Actual Behavior

ServiceMonitor is not created

Additional context

The template is missing the required "endpoints" specification.

@dabo-devconsole dabo-devconsole added the bug Something isn't working label Feb 7, 2024
@dwertent
Copy link
Contributor

Do you have the Prometheus operator running in your cluster?

@dabo-devconsole
Copy link
Author

Yes, the kube-prometheus-stack-operator is running in version v0.71.2 in the cluster.

@dwertent
Copy link
Contributor

This is unusual, I'm unable to reproduce the problem. It seems to be working fine without any issues.
Perhaps we should consider adding the endpoint here just to be cautious.

@aminrj
Copy link

aminrj commented Feb 27, 2024

Hi,
I am experiencing the same issue but while using Prometheus community Helm chart:
│ Error: failed to create resource: ServiceMonitor.monitoring.coreos.com "prometheus-exporter" is invalid: spec.endpoints: Required value

The result is that the pod is in a CrashLoopBackOff:
prometheus-exporter-f4dc7988f-dmf2d 0/1 CrashLoopBackOff 4 (25s ago) 117s

Here is the configuration of the Helm chart:

kubescape:

  # Enable prometheus pod annotations,to allow your opensource prometheus (not operator) to scrape metrics
  prometheusAnnotation:
    enabled: true


capabilities:
  # Kubescape integration with Prometheus Community Hlem chart
  prometheusExporter: enable

@dabo-devconsole
Copy link
Author

Yes it pretty much looks the same. I'm also using the Prometheus community helm chart, especially the prometheus-community/kube-prometheus-stack.

@hyo-shin
Copy link

I have also encountered this issue:

Error: failed to create resource: ServiceMonitor.monitoring.coreos.com "prometheus-exporter" is invalid: spec.endpoints: Required value

I agree with @dwertent suggestion that the spec.endpoints might need to be added here.

@lubgi
Copy link

lubgi commented May 20, 2024

What's the workaround?

@dwertent
Copy link
Contributor

I will look into this today :)

@l-spork-cc
Copy link

l-spork-cc commented Jun 12, 2024

We are experiencing the same problem, we deployed a separate servicemonitor outside of the helm deployment as a workaround. The following ressource definition works for us, depending on how the prometheus instance is configured one might also need to add a label for the prometheus selector (we disabled it completely).

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: prometheus-exporter
  name: kubescape
  namespace: kubescape
spec:
  endpoints:
    - interval: 30s
      targetPort: 8080
      path: /metrics
  namespaceSelector:
    matchNames:
      - kubescape
  selector:
    matchLabels:
      app: prometheus-exporter

@matthyx
Copy link
Contributor

matthyx commented Sep 3, 2024

@dabo-devconsole @l-spork-cc can you check with the latest chart please?

@dabo-devconsole
Copy link
Author

Hi @matthyx,
same error in Chart version 1.21.2. Do I missed something?

@matthyx
Copy link
Contributor

matthyx commented Sep 6, 2024

should be fixed in the next release (probably next week)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants