Updated on 2024-11-25 GMT+08:00

CoreDNS

Add-on Overview

CoreDNS is a DNS server that uses chain plug-ins to provide domain name resolution services for Kubernetes clusters. It is the recommended DNS server solution by the Kubernetes community.

Add-on Parameters

Table 1 Parameters

Parameter

Mandatory

Type

Description

basic

No

object

Basic configuration parameters, which do not need to be specified

flavor

Yes

Table 2 object

Flavor parameters

custom

Yes

Table 3 object

Custom parameters

Table 2 Configuration of flavor

Parameter

Mandatory

Type

Description

replicas

Yes

int

Number of pods. The default value is 2.

resources

Yes

Array of resources object

Container resource (CPU and memory) quotas

Table 3 Configuration of custom

Parameter

Mandatory

Type

Description

servers

No

object

Configuration of servers

stub_domains

No

Map<String>[]string

Stub domain configuration

multiAZEnable

No

bool

Whether to enable the forcible mode of multi-AZ deployment for the deployment component. The default value is false. Deployment pods of the add-on will be forcibly scheduled to nodes in different AZs. If there are fewer AZs than pods, the extra pods will fail to run. If both multiAZEnable and multiAZBalance are set to true, the settings of multiAZBalance take effect, which means, the equivalent mode of multi-AZ deployment is used.

multiAZBalance

No

bool

Whether to enable the equivalent mode of multi-AZ deployment for the deployment component. The default value is false. Deployment pods of the add-on are evenly scheduled to the nodes in the cluster in each AZ. If a new AZ is added, it is recommended that you increase add-on pods for cross-AZ HA deployment. With the equivalent multi-AZ deployment, the difference between the number of add-on pods in different AZs will be less than or equal to 1. If resources in one of the AZs are insufficient, pods cannot be scheduled to that AZ.

tolerations

No

Array of Table 5

Toleration configuration

Table 4 Data structure of the resources field

Parameter

Mandatory

Type

Description

limitsCpu

Yes

String

CPU size limit (unit: m)

limitsMem

Yes

String

Memory size limit (unit: Mi)

name

Yes

String

Add-on name. The value is fixed at coredns.

requestsCpu

Yes

String

Requested CPU size (unit: m)

requestsMem

Yes

String

Requested memory size (unit: Mi)

Table 5 Taints and tolerations

Parameter

Mandatory

Type

Description

key

No

String

Taint key

effect

No

String

Taint policy

operator

No

String

Operator

tolerationSeconds

No

Int

Toleration time window

Table 6 Configuration of server

Parameter

Mandatory

Type

Description

port

No

Int

Domain port number. The default value is 5353.

zones

No

Array of Table 8

Domain configuration

plugins

No

Array of Table 7

Configuration of plugin

Table 7 Configuration of plugin

Parameter

Mandatory

Type

Description

name

Yes

String

Plugin name

configBlock

No

String

Configuration of plugin

parameters

No

String/Int

Extended parameters of the plugin

Table 8 Configuration of zone

Parameter

Mandatory

Type

Description

zone

Yes

String

Domain to be listened on. The default value is a period (.).

Example Request

{
	"kind": "Addon",
	"apiVersion": "v3",
	"metadata": {
		"annotations": {
			"addon.install/type": "install"
		}
	},
	"spec": {
		"clusterID": "2292498e-******-0255ac1001ba",
		"version": "1.29.2",
		"addonTemplateName": "coredns",
		"values": {
                        "basic": {
				"basickey":"val"
			},
			"flavor": {
				"replicas": 2,
				"resources": [{
					"limitsCpu": "2000m",
					"limitsMem": "2000Mi",
					"name": "coredns",
					"requestsCpu": "2000m",
					"requestsMem": "2000Mi"
				}]
			},
			"custom": {
				"multiAZBalance": false,
				"multiAZEnabled": false,
				"node_match_expressions": [],
				"servers": [{
					"plugins": [{
						"name": "bind",
						"parameters": "{$POD_IP}"
					},
					{
						"configBlock": "servfail 5s",
						"name": "cache",
						"parameters": 30
					},
					{
						"name": "errors"
					},
					{
						"name": "health",
						"parameters": "{$POD_IP}:8080"
					},
					{
						"name": "ready",
						"parameters": "{$POD_IP}:8081"
					},
					{
						"configBlock": "pods insecure\nfallthrough in-addr.arpa ip6.arpa",
						"name": "kubernetes",
						"parameters": "cluster.local in-addr.arpa ip6.arpa"
					},
					{
						"name": "loadbalance",
						"parameters": "round_robin"
					},
					{
						"name": "prometheus",
						"parameters": "{$POD_IP}:9153"
					},
					{
						"configBlock": "policy random",
						"name": "forward",
						"parameters": ". /etc/resolv.conf"
					},
					{
						"name": "reload"
					}],
					"port": 5353,
					"zones": [{
						"zone": "."
					}]
				}],
				"stub_domains": {
					
				},
				"tolerations": [{
					"key": "node.kubernetes.io/not-ready",
					"operator": "Exists",
					"effect": "NoExecute",
					"tolerationSeconds": 60
				},
				{
					"key": "node.kubernetes.io/unreachable",
					"operator": "Exists",
					"effect": "NoExecute",
					"tolerationSeconds": 60
				}]
			}
		}
	}
}