kubernetes / autoscaler

Autoscaling components for Kubernetes
Apache License 2.0
8.06k stars 3.97k forks source link

VPA Not able to detect Prometheus StatefulSet #6789

Closed s-mantzou closed 5 months ago

s-mantzou commented 5 months ago

Which component are you using?: VPA Recommender

What version of the component are you using?: 1.0.0

Component version:

What k8s version are you using (kubectl version)?: v1.29.1-eks-b9c9ed7

kubectl version Output
$ kubectl version 1.14.0

What environment is this in?:

What did you expect to happen?: Expected the VPA recommender to be able to discover our Prometheus Stateful set and make a recommendation out of it

What happened instead?: VPA of Prometheus got the following conditions: Last Transition Time: 2024-05-01T15:07:37Z │ │ Message: The targetRef controller has a parent but it should point to a topmost well-known or scalable controller │ │ Status: True │ │ Type: ConfigUnsupported │ │ Last Transition Time: 2024-05-01T15:08:02Z │ │ Message: No pods match this VPA object │ │ Reason: NoPodsMatched │ │ Status: True │ │ Type: NoPodsMatched │ │ Last Transition Time: 2024-05-01T15:08:02Z │ │ Message: No pods match this VPA object │ │ Reason: NoPodsMatched │ │ Status: False │ │ Type: RecommendationProvided

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?: Prometheus is deployed using kps-stack helm chart version 58.1.2

voelzmo commented 5 months ago

@s-mantzou The error message in the Status is on point:

The targetRef controller has a parent but it should point to a topmost well-known or scalable controller

It seems you're pointing your VPA's targetRef to the StatefulSet directly. But, if I'm understanding correctly, your prometheus is actually managed by the prometheus-operator. This message is here to tell you: The resource has an ownerRef which has a /scale subresource, please point your VPA to the owner instead. In this case, the targetRef should point to the Prometheus object, not the CRD itself.

I'm closing this for now, feel free to reopen this with different information.

/kind support /remove-kind bug /close

k8s-ci-robot commented 5 months ago

@voelzmo: Closing this issue.

In response to [this](https://github.com/kubernetes/autoscaler/issues/6789#issuecomment-2096692938): >@s-mantzou The error message in the `Status` is on point: >> The targetRef controller has a parent but it should point to a topmost well-known or scalable controller > >It seems you're pointing your VPA's `targetRef` to the `StatefulSet` directly. But, if I'm understanding correctly, your prometheus is actually managed by the prometheus-operator. >This message is here to tell you: The resource has an `ownerRef` [which has a `/scale` subresource](https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/charts/crds/crds/crd-prometheuses.yaml#L10532), please point your VPA to the owner instead. In this case, the `targetRef` should point to the `Prometheus` object, not the CRD itself. > >I'm closing this for now, feel free to reopen this with different information. > >/kind support >/remove-kind bug >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
s-mantzou commented 5 months ago

@voelzmo Thank you very much ! That was the problem all along!