Enabling HPAContainerMetrics after cluster creation

Hi everyone, how your are doing ok.

I need to create a HorizontalPodAutoscaler with the ContainerResource metric type. This is because on each Pod I have two containers, one for the application and the otherone just as a logging sidecar. I only want to scale based on the application container.

When I try to deploy, this message is shown:

must populate information for the given metric source (only allowed when HPAContainerMetrics feature is enabled)

As far as I understand HPAContainerMetrics flag must be set on cluster creation. Is there a way to enable this afterwards?

Hope you can help.

Best,

Cluster information:

Kubernetes version: 1.21.5

AFAIK, you just have to enable the featuregate and restart the api-server.

One FYI - if you’re using kubeadm you’ll want to update its config so it will be preserved through upgrades.

Thanks for your help.

I used DigitalOcean UI for cluster creation so I’m not really used to kubeadm, but i’ll take a look.