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

NodeLocal DNSCache

Add-on Overview

NodeLocal DNSCache is an add-on developed based on the community NodeLocal DNSCache. This add-on functions as a DaemonSet to run the DNS cache proxy on cluster nodes to improve cluster DNS performance.

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

No

String

Number of admission-controller component instances in the add-on. The default value is 2.

resources

No

Array resources object

Container resource (CPU and memory) quotas

Table 3 Configuration of custom

Parameter

Mandatory

Type

Description

enable_dnsconfig_admission

No

bool

Enables DNSConfig automatic injection. The default value is true. After this function is enabled, a DNSConfig admission controller will be created. The controller intercepts pod creation requests in the namespace labeled with node-localdns-injection=enabled based on Admission Webhook, and automatically configures Pod dnsConfig that uses the DNS cache. If this function is disabled or the pod belongs to a non-target namespace, you must manually configure DNSConfig for the pod.

enable_namespace_admission

No

bool

Adds node-local-dns-injection=enabled to a created namespace. The default value is true. After this tag is added to a namespace, the system identifies the namespace creation request and automatically adds the tag. The target of these operations does not include the built-in namespaces (such as kube-system).

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

Tolerations of the admission-controller component

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 node-local-dns-admission-controller or node-local-dns-cache.

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

Example Request

{
	"kind": "Addon",
	"apiVersion": "v3",
	"metadata": {
		"annotations": {
			"addon.install/type": "install"
		}
	},
	"spec": {
		"clusterID": "2292498e-d169-**********-0255ac1001ba",
		"version": "1.6.2",
		"addonTemplateName": "node-local-dns",
		"values": {
                        "basic": {
				"basickey":"val"
			},
			"flavor": {
				"replicas": 2,
				"resources": [{
					"limitsCpu": "250m",
					"limitsMem": "512Mi",
					"name": "node-local-dns-admission-controller",
					"requestsCpu": "250m",
					"requestsMem": "512Mi"
				},
				{
					"limitsCpu": "500m",
					"limitsMem": "512Mi",
					"name": "node-local-dns-cache",
					"requestsCpu": "25m",
					"requestsMem": "5Mi"
				}]
			},
			"custom": {
				"enable_dnsconfig_admission": true,
				"enable_namespace_admission": true,
				"multiAZBalance": false,
				"multiAZEnabled": false,
				"node_match_expressions": [],
				"tolerations": [{
					"key": "node.kubernetes.io/not-ready",
					"operator": "Exists",
					"effect": "NoExecute",
					"tolerationSeconds": 60
				},
				{
					"key": "node.kubernetes.io/unreachable",
					"operator": "Exists",
					"effect": "NoExecute",
					"tolerationSeconds": 60
				}]
			}
		}
	}
}