Skip to content

Commit c0143d6

Browse files
authored
Merge pull request #74767 from dfitzmau/OSDOCS-7880
OSDOCS-7880: Defining paths for configuring DNS inteface NMSTATE
2 parents 1f3c4d5 + 8a22a52 commit c0143d6

File tree

2 files changed

+122
-42
lines changed

2 files changed

+122
-42
lines changed

modules/virt-example-nmstate-IP-management.adoc

Lines changed: 117 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -91,32 +91,110 @@ The following snippet configures an Ethernet interface that uses a dynamic IP ad
9191
[id="virt-example-nmstate-IP-management-dns_{context}"]
9292
== DNS
9393

94-
Setting the DNS configuration is analagous to modifying the `/etc/resolv.conf` file. The following snippet sets the DNS configuration on the host.
94+
By default, the `nmstate` API stores DNS values globally as against storing them in a network interface. For certain situations, you must configure a network interface to store DNS values. To define a DNS configuration for a network interface, you must initially specify the `dns-resolver` section in the network interface's YAML configuration file.
9595

96+
[TIP]
97+
====
98+
Setting a DNS configuration is comparable to modifying the `/etc/resolv.conf` file.
99+
====
100+
101+
The following examples show situations that require configuring a network interface to store DNS values:
102+
103+
[IMPORTANT]
104+
====
105+
You cannot use `br-ex` bridge, an OVNKubernetes-managed Open vSwitch bridge, as the interface when configuring DNS resolvers.
106+
====
107+
108+
* Configure a static DNS for a network interface with an automatic IP configuration. Note that for this configuration, you must set the `auto-dns` parameter to `false`, so that the Kubernetes NMState Operator can store custom DNS settings for the network interface.
109+
+
96110
[source,yaml]
97111
----
112+
dns-resolver:
113+
config:
114+
search:
115+
- example.com
116+
- example.org
117+
server:
118+
- 2001:db8:f::1
119+
- 192.0.2.251
120+
interfaces:
121+
- name: eth1
122+
type: ethernet
123+
state: up
124+
ipv4:
125+
enabled: true
126+
dhcp: true
127+
auto-dns: false
128+
ipv6:
129+
enabled: true
130+
dhcp: true
131+
autoconf: true
132+
auto-dns: false
98133
# ...
99-
interfaces: <1>
100-
...
101-
ipv4:
102-
...
103-
auto-dns: false
104-
...
105-
dns-resolver:
106-
config:
107-
search:
108-
- example.com
109-
- example.org
110-
server:
111-
- 8.8.8.8
134+
----
135+
136+
* Configure a static DNS for a network interface with a static IP configuration. Note that for this configuration, you must set the `dhcp` parameter to `false` and the `autoconf` parameter to `false`.
137+
+
138+
[source,yaml]
139+
----
140+
dns-resolver:
141+
config:
142+
# ...
143+
server:
144+
- 2001:4860:4860::8844
145+
- 192.0.2.251
146+
interfaces:
147+
- name: eth1
148+
type: ethernet
149+
state: up
150+
ipv4:
151+
enabled: true
152+
dhcp: false
153+
address:
154+
- ip: 192.0.2.251
155+
prefix-length: 24
156+
ipv6:
157+
enabled: true
158+
dhcp: false
159+
autoconf: false
160+
address:
161+
- ip: 2001:db8:1::1
162+
prefix-length: 64
163+
routes:
164+
config:
165+
- destination: 0.0.0.0/0
166+
next-hop-address: 192.0.2.1
167+
next-hop-interface: eth1
168+
- destination: ::/0
169+
next-hop-address: 2001:db8:1::3
170+
next-hop-interface: eth1
112171
# ...
113172
----
114-
<1> You must configure an interface with `auto-dns: false` or you must use static IP configuration on an interface in order for Kubernetes NMState to store custom DNS settings.
115173

116-
[IMPORTANT]
117-
====
118-
You cannot use `br-ex`, an OVNKubernetes-managed Open vSwitch bridge, as the interface when configuring DNS resolvers.
119-
====
174+
* Configure a static DNS name server to append to Dynamic Host Configuration Protocol (DHCP) and IPv6 Stateless Address AutoConfiguration (SLAAC) servers:
175+
+
176+
[source,yaml]
177+
----
178+
dns-resolver:
179+
config:
180+
# ...
181+
server:
182+
- 192.0.2.251
183+
interfaces:
184+
- name: eth1
185+
type: ethernet
186+
state: up
187+
ipv4:
188+
enabled: true
189+
dhcp: true
190+
auto-dns: true
191+
ipv6:
192+
enabled: true
193+
dhcp: true
194+
autoconf: true
195+
auto-dns: true
196+
# ...
197+
----
120198

121199
[id="virt-example-nmstate-IP-management-static-routing_{context}"]
122200
== Static routing
@@ -125,25 +203,27 @@ The following snippet configures a static route and a static IP on interface `et
125203

126204
[source,yaml]
127205
----
206+
dns-resolver:
207+
config:
128208
# ...
129-
interfaces:
130-
- name: eth1
131-
description: Static routing on eth1
132-
type: ethernet
133-
state: up
134-
ipv4:
135-
dhcp: false
136-
address:
137-
- ip: 192.0.2.251 <1>
138-
prefix-length: 24
139-
enabled: true
140-
routes:
141-
config:
142-
- destination: 198.51.100.0/24
143-
metric: 150
144-
next-hop-address: 192.0.2.1 <2>
145-
next-hop-interface: eth1
146-
table-id: 254
209+
interfaces:
210+
- name: eth1
211+
description: Static routing on eth1
212+
type: ethernet
213+
state: up
214+
ipv4:
215+
dhcp: false
216+
enabled: true
217+
address:
218+
- ip: 192.0.2.251 <1>
219+
prefix-length: 24
220+
routes:
221+
config:
222+
- destination: 198.51.100.0/24
223+
metric: 150
224+
next-hop-address: 192.0.2.1 <2>
225+
next-hop-interface: eth1
226+
table-id: 254
147227
# ...
148228
----
149229
<1> The static IP address for the Ethernet interface.

networking/k8s_nmstate/k8s-nmstate-updating-node-network-config.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ The following examples show different `NodeNetworkConfigurationPolicy` manifest
4242

4343
For best performance, consider the following factors when applying a policy:
4444

45-
* When you need to apply a policy to more than one node, create a `NodeNetworkConfigurationPolicy` manifest for each target node. Scoping a policy to a single node reduces the overall length of time for the Kubernetes NMState Operator to apply the policies.
45+
* When you need to apply a policy to more than one node, create a `NodeNetworkConfigurationPolicy` manifest for each target node. Scoping a policy to a single node reduces the overall length of time for the Kubernetes NMState Operator to apply the policies.
4646
+
47-
In contrast, if a single policy includes configurations for several nodes, the Kubernetes NMState Operator applies the policy to each node in sequence, which increases the overall length of time for policy application.
47+
In contrast, if a single policy includes configurations for several nodes, the Kubernetes NMState Operator applies the policy to each node in sequence, which increases the overall length of time for policy application.
4848

49-
* All related network configurations should be specified in a single policy.
49+
* All related network configurations should be specified in a single policy.
5050
+
51-
When a node restarts, the Kubernetes NMState Operator cannot control the order in which policies are applied. Therefore, the Kubernetes NMState Operator might apply interdependent policies in a sequence that results in a degraded network object.
51+
When a node restarts, the Kubernetes NMState Operator cannot control the order in which policies are applied. Therefore, the Kubernetes NMState Operator might apply interdependent policies in a sequence that results in a degraded network object.
5252

5353
include::modules/virt-example-bridge-nncp.adoc[leveloffset=+2]
5454

@@ -88,5 +88,5 @@ include::modules/virt-example-inherit-static-ip-from-nic.adoc[leveloffset=+2]
8888
.Additional resources
8989
* link:https://nmstate.io/nmpolicy/user-guide/102-policy-syntax.html[The NMPolicy project - Policy syntax]
9090

91-
// Dropping offset by one again
91+
// Examples: IP management
9292
include::modules/virt-example-nmstate-IP-management.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)