Skip to content

Commit 0d12010

Browse files
authored
Merge pull request #87491 from DCChadwick/osdocs11202b
OSDOCS11202: Clarifying and Adding Detail to "Controlling DNS pod placement” doc
2 parents da9efb0 + 39ede64 commit 0d12010

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

modules/nw-controlling-dns-pod-placement.adoc

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88

99
The DNS Operator has two daemon sets: one for CoreDNS called `dns-default` and one for managing the `/etc/hosts` file called `node-resolver`.
1010

11-
You might find a need to control which nodes have CoreDNS pods assigned and running, although this is not a common operation. For example, if the cluster administrator has configured security policies that can prohibit communication between pairs of nodes, that would necessitate restricting the set of nodes on which the daemonset for CoreDNS runs. If DNS pods are running on some nodes in the cluster and the nodes where DNS pods are not running have network connectivity to nodes where DNS pods are running, DNS service will be available to all pods.
11+
You can assign and run CoreDNS pods on specified nodes. For example, if the cluster administrator has configured security policies that prohibit communication between pairs of nodes, you can configure CoreDNS pods to run on a restricted set of nodes.
12+
13+
DNS service is available to all pods if the following circumstances are true:
14+
15+
* DNS pods are running on some nodes in the cluster.
16+
* The nodes on which DNS pods are not running have network connectivity to nodes on which DNS pods are running,
1217
1318
The `node-resolver` daemon set must run on every node host because it adds an entry for the cluster image registry to support pulling images. The `node-resolver` pods have only one job: to look up the `image-registry.openshift-image-registry.svc` service's cluster IP address and add it to `/etc/hosts` on the node host so that the container runtime can resolve the service name.
1419

@@ -23,25 +28,49 @@ As a cluster administrator, you can use a custom node selector to configure the
2328
.Procedure
2429

2530
* To allow the daemon set for CoreDNS to run on certain nodes, configure a taint and toleration:
31+
32+
. Set a taint on the nodes that you want to control DNS pod placement by entering the following command:
33+
+
34+
[source,terminal]
35+
----
36+
$ oc adm taint nodes <node_name> dns-only=abc:NoExecute <1>
37+
----
2638
+
27-
. Modify the DNS Operator object named `default`:
39+
<1> Replace `<node_name>` with the actual name of the node.
40+
41+
. Modify the DNS Operator object named `default` to include the corresponding toleration by entering the following command:
2842
+
2943
[source,terminal]
3044
----
3145
$ oc edit dns.operator/default
3246
----
33-
+
34-
. Specify a taint key and a toleration for the taint:
47+
48+
. Specify a taint key and a toleration for the taint. The following toleration matches the taint set on the nodes.
3549
+
3650
[source,yaml]
3751
----
3852
spec:
3953
nodePlacement:
4054
tolerations:
4155
- effect: NoExecute
42-
key: "dns-only"
43-
operators: Equal
56+
key: "dns-only" <1>
57+
operator: Equal
4458
value: abc
45-
tolerationSeconds: 3600 <1>
59+
tolerationSeconds: 3600 <2>
4660
----
47-
<1> If the taint is `dns-only`, it can be tolerated indefinitely. You can omit `tolerationSeconds`.
61+
<1> If the `key` field is set to `dns-only`, it can be tolerated indefinitely.
62+
<2> The `tolerationSeconds` field is optional.
63+
64+
. Optional: To specify node placement using a node selector, modify the default DNS Operator:
65+
66+
.. Edit the DNS Operator object named `default` to include a node selector:
67+
+
68+
[source,yaml]
69+
----
70+
spec:
71+
nodePlacement:
72+
nodeSelector: <1>
73+
node-role.kubernetes.io/control-plane: ""
74+
----
75+
+
76+
<1> This node selector ensures that the CoreDNS pods run only on control plane nodes.

0 commit comments

Comments
 (0)