kubernetes / autoscaler

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

Unable to monitor etcd-cluster pods managed by etcd-operator #6591

Closed deepakzac closed 7 months ago

deepakzac commented 7 months ago

Which component are you using?:

vertical-pod-autoscaler What version of the component are you using?: VPA version 1.0

Component version:

What k8s version are you using (kubectl version)?:

kubectl version Output
$ kubectl version
Client Version: v1.27.0
Kustomize Version: v5.0.1
Server Version: v1.26.3

What environment is this in?: On Prem

What did you expect to happen?: VPA is successfully created and provides recommendation for etcd-cluster service

What happened instead?: See the below error

❯ kubectl describe vpa -A
Name:         custom-etcd-cluster
Namespace:    cm
Labels:       <none>
Annotations:  <none>
API Version:  autoscaling.k8s.io/v1
Kind:         VerticalPodAutoscaler
Metadata:
  Creation Timestamp:  2024-03-06T15:36:21Z
  Generation:          1
  Resource Version:    694859
  UID:                 11a87626-17fa-49bc-a68a-84850823fbff
Spec:
  Target Ref:
    API Version:  etcd.database.coreos.com/v1beta2
    Kind:         EtcdCluster
    Name:         etcd-cluster
  Update Policy:
    Update Mode:  Off
Status:
  Conditions:
    Last Transition Time:  2024-03-06T15:36:29Z
    Message:               Cannot read targetRef. Reason: Unhandled targetRef etcd.database.coreos.com/v1beta2 / EtcdCluster / etcd-cluster, last error etcdclusters.etcd.database.coreos.com "etcd-cluster" not found
    Status:                True
    Type:                  ConfigUnsupported
<truncated for brevity>

❯ kubectl get etcdclusters.etcd.database.coreos.com -n cm etcd-cluster
NAME           AGE
etcd-cluster   24h

❯ kubectl describe etcdclusters.etcd.database.coreos.com -n cm etcd-cluster
Name:         etcd-cluster
Namespace:    cm
Labels:       app=etcd

API Version:  etcd.database.coreos.com/v1beta2
Kind:         EtcdCluster
<truncated for brevity>
  Members:
    Ready:
      etcd-cluster-9zqk8rj9mn
      etcd-cluster-ftzgrjtfj5
      etcd-cluster-lsvstvspn4
  Phase:           Running
  Service Name:    etcd-cluster-client
  Size:            3
  Target Version:
Events:            <none>
<truncated for brevity>

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

Anything else we need to know?:

Shubham82 commented 7 months ago

/area vertical-pod-autoscaler

voelzmo commented 7 months ago

Hey @deepakzac, thanks for the detailed description!

I can see that you're using a CRD to manage your etcd cluster. Similar to the Horizontal Pod Autoscaler, the VPA has some requirements for autoscaling custom resources, namely it needs the /scale subresource.

Looking at the CRD's name, I'm wondering if you are using the CoreOS etcd operator? Given that the project is archived for a few years already, this seems not like a good idea. You might want to switch to an alternative, which hopefully also supports the /scale subresource, such as https://github.com/gardener/etcd-druid or find a different way to provide a managed etcd solution.

I'm closing this for now, feel free to re-open with additional information if I'm getting things wrong here!

/remove-kind bug /kind support /close

k8s-ci-robot commented 7 months ago

@voelzmo: Closing this issue.

In response to [this](https://github.com/kubernetes/autoscaler/issues/6591#issuecomment-1982882264): >Hey @deepakzac, thanks for the detailed description! > >I can see that you're using a CRD to manage your etcd cluster. Similar to the Horizontal Pod Autoscaler, the VPA [has some requirements for autoscaling custom resources](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/FAQ.md#how-can-i-apply-vpa-to-my-custom-resource), namely it needs the `/scale` subresource. > >Looking at the CRD's name, I'm wondering if you are using the [CoreOS etcd operator](https://github.com/coreos/etcd-operator)? Given that the project is archived for a few years already, this seems not like a good idea. You might want to switch to an alternative, which hopefully also supports the `/scale` subresource, such as https://github.com/gardener/etcd-druid or find a different way to provide a managed etcd solution. > >I'm closing this for now, feel free to re-open with additional information if I'm getting things wrong here! > >/remove-kind bug >/kind support >/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/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
deepakzac commented 7 months ago

@voelzmo Thank you for the quick response and the pointer to the FAQ. I missed that. Makes sense. And yes, we are using the operator from CoreOS.