---
title: How to Configure CoreDNS Autoscaling for DigitalOcean Kubernetes
description: Configure the Cluster Proportional Autoscaler plugin to automatically scale CoreDNS replicas based on cluster size.
product: Kubernetes
url: https://docs.digitalocean.com/products/kubernetes/how-to/configure-coredns-autoscaling/
last_updated: "2026-10-08"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# How to Configure CoreDNS Autoscaling for DigitalOcean Kubernetes

DigitalOcean Kubernetes (DOKS) is a Kubernetes service with a fully managed control plane, high availability, and autoscaling. DOKS integrates with standard Kubernetes toolchains and DigitalOcean’s load balancers, volumes, CPU and GPU Droplets, API, and CLI.

DigitalOcean Kubernetes (DOKS) includes a Cluster Proportional Autoscaler (CPA) plugin that automatically scales CoreDNS replicas in proportion to your cluster’s size. The plugin uses the number of nodes and CPU cores in your cluster to calculate how many CoreDNS replicas to run, which prevents DNS resolution failures as your workloads grow. CPA scales CoreDNS pods only. To scale the number of nodes in a cluster, see [How to Enable Cluster Autoscaler](https://docs.digitalocean.com/products/kubernetes/how-to/autoscale/index.html.md).

By default, DOKS clusters without CPA run two CoreDNS replicas. Because all external DNS queries from the cluster funnel through these replicas, larger clusters can exceed DigitalOcean’s per-source-IP DNS rate limits and experience slow or dropped queries. CPA addresses this by adding more CoreDNS replicas as the cluster scales, distributing DNS traffic across more source IPs.

CPA is enabled by default on new clusters running Kubernetes 1.36 or later. When you upgrade an existing cluster to Kubernetes 1.37 or later, DOKS enables CPA automatically if CoreDNS is still running the default of two replicas. If you have manually changed the CoreDNS replica count, DOKS leaves it as is, and you can enable CPA yourself. You can [view the current configuration](#view-the-cpa-configuration), [customize scaling parameters](#customize-scaling-parameters), or [enable or disable the plugin](#enable-or-disable-the-cpa-plugin).

## How CPA Scales CoreDNS

CPA uses a linear scaling algorithm. It reads scaling parameters from a ConfigMap named `cluster-proportional-autoscaler` in the `kube-system` namespace and recalculates the desired CoreDNS replica count whenever the cluster’s node or core count changes.

The formula is:

```text
replicas = max(ceil(cores / coresPerReplica), ceil(nodes / nodesPerReplica))
```

The default scaling parameters are:

| Parameter | Default | Description |
|---|---|---|
| `coresPerReplica` | 256 | Number of CPU cores per CoreDNS replica |
| `nodesPerReplica` | 16 | Number of nodes per CoreDNS replica |
| `preventSinglePointFailure` | true | Enforces a minimum of two replicas when there is more than one node |
| `includeUnschedulableNodes` | true | Counts cordoned or draining nodes toward the total, which keeps replica counts stable during maintenance |

With these defaults, the replica count scales as follows:

| Cluster Size | By Cores (cores / 256) | By Nodes (nodes / 16) | CoreDNS Replicas |
|---|---|---|---|
| 3 nodes, 6 cores | 1 | 1 | 2 (min) |
| 16 nodes, 32 cores | 1 | 1 | 2 (min) |
| 32 nodes, 64 cores | 1 | 2 | 2 |
| 48 nodes, 96 cores | 1 | 3 | 3 |
| 64 nodes, 128 cores | 1 | 4 | 4 |
| 100 nodes, 400 cores | 2 | 7 | 7 |
| 200 nodes, 800 cores | 4 | 13 | 13 |

## View the CPA Configuration

To view the current CPA scaling parameters, retrieve the `cluster-proportional-autoscaler` ConfigMap:

```shell
kubectl get configmap cluster-proportional-autoscaler -n kube-system -o yaml
```

The output looks similar to the following:

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: cluster-proportional-autoscaler
  namespace: kube-system
data:
  linear: |
    {
      "coresPerReplica": 256,
      "nodesPerReplica": 16,
      "preventSinglePointFailure": true,
      "includeUnschedulableNodes": true
    }
```

## Customize Scaling Parameters

You can adjust how quickly CPA adds CoreDNS replicas by editing the `cluster-proportional-autoscaler` ConfigMap. Scaling parameters cannot be set through the DigitalOcean API, so edit the ConfigMap directly on the cluster. For example, lowering `nodesPerReplica` adds replicas more quickly as you add nodes.

To edit the ConfigMap, open it with `kubectl`:

```shell
kubectl edit configmap cluster-proportional-autoscaler -n kube-system
```

Update the values in the `linear` key. The following example adds a CoreDNS replica for every 8 nodes instead of every 16:

```yaml
data:
  linear: |
    {
      "coresPerReplica": 256,
      "nodesPerReplica": 8,
      "preventSinglePointFailure": true,
      "includeUnschedulableNodes": true
    }
```

Save and close the file. CPA applies the new configuration automatically and adjusts the CoreDNS replica count on its next reconciliation cycle.

DOKS preserves your ConfigMap changes and does not overwrite them during reconciliation. New defaults only apply to new clusters or clusters that have not been modified.

**Warning**:

  While CPA is enabled, it overrides any manual changes to the CoreDNS Deployment replica count. To set a specific number of replicas manually, [disable the CPA plugin](#enable-or-disable-the-cpa-plugin) first.

## Verify CoreDNS Scaling

To check the current number of CoreDNS replicas running in your cluster:

```shell
kubectl get deployment coredns -n kube-system
```

The output looks similar to the following:

```text
NAME      READY   UP-TO-DATE   AVAILABLE   AGE
coredns   3/3     3            3           5d
```

The `READY` column shows the number of running replicas out of the desired count.

## Enable or Disable the CPA Plugin

You can enable or disable the CPA plugin using `doctl`, the DigitalOcean API, Godo, or Terraform. Disabling the plugin removes the CPA controller and its associated resources (ConfigMap, ServiceAccount, ClusterRole, and ClusterRoleBinding) from the cluster. CoreDNS retains its current replica count when you disable the plugin and does not scale back down to two replicas. Disabling the plugin deletes the cluster-proportional-autoscaler ConfigMap. If you re-enable the plugin later, DOKS recreates the ConfigMap with default values and any custom scaling parameters you previously set are lost. Re-enabling recalculates the desired replica count based on the current cluster size and adjusts CoreDNS accordingly.

In the API, the plugin is controlled through the `coredns_autoscaler` object on the Kubernetes cluster resource. Set `enabled` to `true` to turn CPA on, or `false` to turn it off. Omitting the `coredns_autoscaler` object from a request leaves the plugin’s current state unchanged.

### doctl

To disable the CPA plugin on an existing cluster:

```shell
doctl kubernetes cluster update <your-cluster-id> --enable-coredns-autoscaler=false
```

To re-enable the CPA plugin:

```shell
doctl kubernetes cluster update <your-cluster-id> --enable-coredns-autoscaler=true
```

### cURL

To disable the CPA plugin on an existing cluster, send a `PUT` request to `https://api.digitalocean.com/v2/kubernetes/clusters/{cluster_id}` with a request body similar to the following:

```shell
curl --location --request PUT 'https://api.digitalocean.com/v2/kubernetes/clusters/{cluster_id}' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
--data '{
    "name": "example-cluster",
    "coredns_autoscaler": {
        "enabled": false
    }
}'
```

To re-enable the CPA plugin, send the same request with `"enabled": true`.

To disable CPA when creating a new cluster (for example, if you plan to manage CoreDNS replicas manually), send a `POST` request to `https://api.digitalocean.com/v2/kubernetes/clusters` with a request body similar to the following:

```shell
curl --location 'https://api.digitalocean.com/v2/kubernetes/clusters' \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
--data '{
    "name": "example-cluster",
    "region": "nyc1",
    "version": "1.36.1-do.0",
    "node_pools": [
        {
            "size": "s-2vcpu-4gb",
            "count": 3,
            "name": "worker-pool"
        }
    ],
    "coredns_autoscaler": {
        "enabled": false
    }
}'
```

### Go

Go developers can use [Godo](https://github.com/digitalocean/godo), the official DigitalOcean V2 API client for Go. To disable the CPA plugin on an existing cluster with Godo, use code similar to the following:

```go
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken("your-digitalocean-token")

	cluster, _, err := client.Kubernetes.Update(context.Background(), "your-cluster-id", &godo.KubernetesClusterUpdateRequest{
		Name: "example-cluster",
		CorednsAutoscaler: &godo.KubernetesCorednsAutoscaler{
			Enabled: godo.PtrTo(false),
		},
	})
	if err != nil {
		fmt.Printf("Error updating cluster: %s\n", err)
		os.Exit(1)
	}

	isEnabled := *cluster.CorednsAutoscaler.Enabled
	fmt.Printf("Cluster update successfully issued with CoreDNS autoscaler enabled=%v\n", isEnabled)
}
```

To disable CPA when creating a new cluster, use code similar to the following:

```go
package main

import (
	"context"
	"fmt"
	"os"

	"github.com/digitalocean/godo"
)

func main() {
	client := godo.NewFromToken("your-digitalocean-token")

	cluster, _, err := client.Kubernetes.Create(context.Background(), &godo.KubernetesClusterCreateRequest{
		Name:        "example-cluster",
		RegionSlug:  "nyc1",
		VersionSlug: "1.36.1-do.0",
		NodePools: []*godo.KubernetesNodePoolCreateRequest{
			{
				Name:  "worker-pool",
				Count: 3,
				Size:  "s-2vcpu-4gb",
			},
		},
		CorednsAutoscaler: &godo.KubernetesCorednsAutoscaler{
			Enabled: godo.PtrTo(false),
		},
	})
	if err != nil {
		fmt.Printf("Error creating cluster: %s\n", err)
		os.Exit(1)
	}

	isEnabled := *cluster.CorednsAutoscaler.Enabled
	fmt.Printf("Cluster creation successfully issued with CoreDNS autoscaler enabled=%v\n", isEnabled)
}
```

### Terraform

To disable the CPA plugin on an existing cluster, add a `coredns_autoscaler` block to the `digitalocean_kubernetes_cluster` resource:

```hcl
resource "digitalocean_kubernetes_cluster" "example" {
  name    = "example-cluster"
  region  = "nyc1"
  version = "1.36.1-do.0"

  node_pool {
    name       = "worker-pool"
    size       = "s-2vcpu-4gb"
    node_count = 3
  }

  coredns_autoscaler {
    enabled = false
  }
}
```

To re-enable the CPA plugin, set `enabled = true` in the same block.

If you experience CoreDNS issues in your cluster, see [How to Troubleshoot CoreDNS Issues in DOKS Clusters](https://docs.digitalocean.com/support/how-to-troubleshoot-coredns-issues-in-doks-clusters/index.html.md). For CoreDNS configuration changes beyond scaling, see [How to Customize CoreDNS for Kubernetes Clusters](https://docs.digitalocean.com/products/kubernetes/how-to/customize-coredns/index.html.md). For more details on the upstream Cluster Proportional Autoscaler, see the [cluster-proportional-autoscaler](https://github.com/kubernetes-sigs/cluster-proportional-autoscaler) repository and the Kubernetes guide to [DNS Horizontal Autoscaling](https://kubernetes.io/docs/tasks/administer-cluster/dns-horizontal-autoscaling/).