How to configure the CoreDNS Autoscaler in a Rancher Kubernetes Engine (RKE) CLI or Rancher v2.x provisioned Kubernetes cluster
This document (000020133) is provided subject to the disclaimer at the end of this document.
Situation
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
- Navigate to the Cluster within the Rancher UI and click 'Edit Cluster'.
- Click 'Edit as YAML'.
-
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
-
Click 'Save' to update the cluster with the new configuration.
A Rancher provisioned cluster managed by Rancher versions before v2.4.x
- Navigate to the Cluster within the Rancher UI and click 'Edit Cluster'.
- Click 'Edit as YAML'.
-
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
-
Click 'Save' to update the cluster with the new configuration.
An RKE provisioned cluster managed by RKE versions after v1.1.0
-
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
-
Invoke
rke up --config <cluster configuration YAML file>
to update the cluster.
An RKE provisioned cluster managed by RKE versions before v1.1.0
-
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
-
Invoke
rke up --config <cluster configuration YAML file>
to update the cluster.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000020133
- Creation Date: 06-May-2021
- Modified Date:06-May-2021
-
- SUSE Rancher
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com