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

A CRD is missing when deploying the kube-prometheus-stack with Argo CD #2075

Closed
lucj opened this issue Apr 13, 2023 · 4 comments
Closed

A CRD is missing when deploying the kube-prometheus-stack with Argo CD #2075

lucj opened this issue Apr 13, 2023 · 4 comments

Comments

@lucj
Copy link

lucj commented Apr 13, 2023

When deploying the kube-prometheus-stack with the following definition:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: kube-prometheus-stack
  namespace: argocd
  finalizers:
    - resources-finalizer.argocd.argoproj.io
spec:
  destination:
    server: https://kubernetes.default.svc
    namespace: monitoring
  project: default
  source:
    repoURL: https://prometheus-community.github.io/helm-charts
    targetRevision: 45.9.1
    chart: kube-prometheus-stack
    helm:
      releaseName: kube-prometheus
      parameters:
      - name: prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues
        value: "false"
      - name: prometheus.prometheusSpec.serviceMonitorSelector
        value: "{}"
      - name: prometheus.prometheusSpec.serviceMonitorNamespaceSelector
        value: "{}"
  syncPolicy:
    automated:
      prune: true
      selfHeal: true
    syncOptions:
      - CreateNamespace=true

I can see the following CRDs are created:

$ k get crds | grep coreos
prometheusrules.monitoring.coreos.com       2023-04-13T12:11:36Z
servicemonitors.monitoring.coreos.com       2023-04-13T12:11:36Z
alertmanagerconfigs.monitoring.coreos.com   2023-04-13T12:11:36Z
probes.monitoring.coreos.com                2023-04-13T12:11:36Z
podmonitors.monitoring.coreos.com           2023-04-13T12:11:36Z
alertmanagers.monitoring.coreos.com         2023-04-13T12:11:36Z
thanosrulers.monitoring.coreos.com          2023-04-13T12:11:36Z

but I cannot see metrics in the dashboard.
From the logs, the prometheuses.monitoring.coreos.com CRD is missing:

level=error ts=2023-04-13T12:15:16.836941424Z caller=klog.go:116 component=k8s_client_runtime func=ErrorDepth msg="pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:169: Failed to watch *v1.Prometheus: failed to list *v1.Prometheus: the server could not find the requested resource (get prometheuses.monitoring.coreos.com)"

Any idea what could be wrong ?

@lucj lucj changed the title Cannot deploy the kube-prometheus-stack with Argo CD A CRD is missing when deploying the kube-prometheus-stack with Argo CD Apr 13, 2023
@KGB33
Copy link

KGB33 commented Apr 20, 2023

I ran into (what I think is) the same issue. After digging into the logs it looks like ArgoCD (and kubectl apply) can't add the previous definition in the last-applied-configuration annotation. I had the error message below:

Error from server (Invalid): error when creating "manifests/setup/prometheus-operator-0prometheusCustomResourceDefinition.yaml": CustomResourceDefinition.apiextensions.k8s.io "prom
etheuses.monitoring.coreos.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

The solution (found here) is to set the ServerSideApply=true syncOperation for Argo, or use kubectl create (instead of apply).

@lucj
Copy link
Author

lucj commented Apr 20, 2023 via email

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity in the last 60 days. Thank you for your contributions.

@github-actions
Copy link

This issue was closed because it has not had any activity in the last 120 days. Please reopen if you feel this is still valid.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants