How to configure the CoreDNS Autoscaler in a Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster

Follow
Table of Contents

Task

During the life of a cluster, you may need to adjust the scaling parameters for the kube-dns or CoreDNS autoscaler. The autoscaler runs as an independant Deployment in the cluster, using the cluster-proportional-autoscaler container to scale up and down the related kube-dns or CoreDNS Deployment, using a linear or ladder pattern.

Pre-requisites

  • A Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster
  • The cluster is configured with either the kube-dns or coredns provider (enabled by default)

Note When running rke up commands, ensure the .rkestate file for the cluster is present in the working directory as per the documentation here.

Steps

Four approaches are provided, depending on the Rancher or RKE version in use.

Note: When making the changes, the coredns-autoscaler or kube-dns-autoscaler` pod will be restarted with updated command arguments, this will not cause any disruption to DNS resolution.

Note: Check the logs of the kube-dns-autoscaler, or coredns-autoscaler pod after making changes to confirm they have taken effect.

A Rancher provisioned cluster managed by Rancher versions after v2.4.x

  1. Navigate to the Cluster within the Rancher UI and click 'Edit Cluster'.
  2. Click 'Edit as YAML'.
  3. Locate or add the dns field, using the below as an example to add the desired parameters below:

    rancher_kubernetes_engine_config:
      [...]
      dns:
        linear_autoscaler_params:
          cores_per_replica: 128
          max: 0
          min: 1
          nodes_per_replica: 4
          prevent_single_point_failure: true
  4. Click 'Save' to update the cluster with the new configuration.

A Rancher provisioned cluster managed by Rancher versions before v2.4.x

  1. Navigate to the Cluster within the Rancher UI and click 'Edit Cluster'.
  2. Click 'Edit as YAML'.
  3. Locate or add the addons field, using the below as an example to add the desired parameters:

    rancher_kubernetes_engine_config:
      [...]
      addons: |-
        apiVersion: v1
        data:
          linear: '{"coresPerReplica":128,"min":1,"nodesPerReplica":4,"preventSinglePointFailure":true}'
        kind: ConfigMap
        metadata:
          name: coredns-autoscaler
          namespace: kube-system
  4. Click 'Save' to update the cluster with the new configuration.

An RKE provisioned cluster managed by RKE versions after v1.1.0

  1. Edit the cluster configuration YAML file to configure the dns field, using the below as an example to add the desired parameters below:

    dns:
      linear_autoscaler_params:
        cores_per_replica: 128
        max: 0
        min: 1
        nodes_per_replica: 4
        prevent_single_point_failure: true
  2. Invoke rke up --config <cluster configuration YAML file> to update the cluster.

An RKE provisioned cluster managed by RKE versions before v1.1.0

  1. Edit the cluster configuration YAML file to configure the ConfigMap addon, using the below as an example to add the desired parameters below:

    addons: |-
      apiVersion: v1
      data:
        linear: '{"coresPerReplica":128,"min":1,"nodesPerReplica":4,"preventSinglePointFailure":true}'
      kind: ConfigMap
      metadata:
        name: coredns-autoscaler
        namespace: kube-system
  2. Invoke rke up --config <cluster configuration YAML file> to update the cluster.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.