Deploying the Kube-Prometheus-Stack through ArgoCD is resulting in a metadata.annotations: Too long error. Here's a workaround.

While deploying the latest Kube-Prometheus-Stack through ArgoCD I started to encounter the following error.

The CustomResourceDefinition "prometheuses.monitoring.coreos.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

The problem is due to the way ArgoCD applies manifests. It uses kubectl apply which stores the entire manifest in an annotation. This is a really big CustomResourceDefinition so it breaks.

The way I worked around it was by manually applying the manifest using kubectl create.

kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/main/example/prometheus-operator-crd/monitoring.coreos.com_prometheuses.yaml

After manually applying the CustomResourceDefinition I was able to finally get the latest Helm chart installed.