<p>In <a href="https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-cooldown-delay" rel="nofollow noreferrer">the documentation</a>, I found that the following flag should be applied on <code>kube-controller-manager</code> to solve my problem:</p>

<pre><code>--horizontal-pod-autoscaler-use-rest-clients=1m0s
</code></pre>

<p>But how can I apply this flag on <code>kube-controller-manager</code>? I don't understand, since it is not YAML based setting and the only thing I have on my local machine is <code>kubectl</code> &amp; <code>oc</code> CLI tools.</p>

silent-box
<p>The <code>kube-controller-manager</code> runs in your K8s control plane. So you will have to add that flag on the servers where your control plane runs. Typically, this is an uneven number of server (one is the master) 3 or 5 due to the fact that it's the recommended quorum. (<a href="https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/high-availability/" rel="noreferrer">Example using kubeadm</a>).</p>

<p>So typically the <code>kube-controller-manager</code> configs live under <code>/etc/kubernetes/manifests</code> in your masters. The file name typically is <code>kube-controller-manager.yaml</code> and the content can be changed to something like this:</p>

<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    component: kube-controller-manager
    tier: control-plane
  name: kube-controller-manager
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-controller-manager
    - --authentication-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --authorization-kubeconfig=/etc/kubernetes/controller-manager.conf
    - --bind-address=127.0.0.1
    - --client-ca-file=/var/lib/minikube/certs/ca.crt
    - --cluster-signing-cert-file=/var/lib/minikube/certs/ca.crt
    - --cluster-signing-key-file=/var/lib/minikube/certs/ca.key
    - --controllers=*,bootstrapsigner,tokencleaner
    - --kubeconfig=/etc/kubernetes/controller-manager.conf
    - --leader-elect=true
    - --requestheader-client-ca-file=/var/lib/minikube/certs/front-proxy-ca.crt
    - --root-ca-file=/var/lib/minikube/certs/ca.crt
    - --service-account-private-key-file=/var/lib/minikube/certs/sa.key
    - --use-service-account-credentials=true
    - --horizontal-pod-autoscaler-use-rest-clients=1m0s  &lt;== add this line
    image: k8s.gcr.io/kube-controller-manager:v1.16.2
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 8
      httpGet:
        host: 127.0.0.1
        path: /healthz
        port: 10252
        scheme: HTTP
      initialDelaySeconds: 15
      timeoutSeconds: 15
    name: kube-controller-manager
    resources:
      requests:
        cpu: 200m
    volumeMounts:
    - mountPath: /etc/ssl/certs
      name: ca-certs
      readOnly: true
    - mountPath: /var/lib/minikube/certs
      name: k8s-certs
      readOnly: true
    - mountPath: /etc/kubernetes/controller-manager.conf
      name: kubeconfig
      readOnly: true
    - mountPath: /usr/share/ca-certificates
      name: usr-share-ca-certificates
      readOnly: true
  hostNetwork: true
  priorityClassName: system-cluster-critical
  volumes:
  - hostPath:
      path: /etc/ssl/certs
      type: DirectoryOrCreate
    name: ca-certs
  - hostPath:
      path: /var/lib/minikube/certs
      type: DirectoryOrCreate
    name: k8s-certs
  - hostPath:
      path: /etc/kubernetes/controller-manager.conf
      type: FileOrCreate
    name: kubeconfig
  - hostPath:
      path: /usr/share/ca-certificates
      type: DirectoryOrCreate
    name: usr-share-ca-certificates
status: {}
</code></pre>

<p>Then you need to restart your kube-controller-manager.</p>

<p>This could vary depending on what you are running in your masters. If something like docker you can do <code>sudo systemctl restart docker</code> or you might need to restart containerd if you are using it instead of docker <code>systemctl restart containerd</code></p>

<p>Or if you want to just start the <code>kube-controller-manager</code> you can do <code>docker restart kube-controller-mamnager</code> or <code>crictl stop kube-controller-manager; crictl start kube-controller-manager</code></p>
