1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/virt-creating-interface-on-nodes.adoc
2023-10-30 10:13:25 -04:00

67 lines
2.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/k8s_nmstate/k8s-nmstate-updating-node-network-config.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-creating-interface-on-nodes_{context}"]
= Creating an interface on nodes
Create an interface on nodes in the cluster by applying a `NodeNetworkConfigurationPolicy` manifest to the cluster. The manifest details the requested configuration for the interface.
By default, the manifest applies to all nodes in the cluster. To add the interface to specific nodes, add the `spec: nodeSelector` parameter and the appropriate `<key>:<value>` for your node selector.
You can configure multiple nmstate-enabled nodes concurrently. The configuration applies to 50% of the nodes in parallel. This strategy prevents the entire cluster from being unavailable if the network connection fails. To apply the policy configuration in parallel to a specific portion of the cluster, use the `maxUnavailable` field.
.Procedure
. Create the `NodeNetworkConfigurationPolicy` manifest. The following example configures a Linux bridge on all worker nodes and configures the DNS resolver:
+
[source,yaml]
----
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: br1-eth1-policy <1>
spec:
nodeSelector: <2>
node-role.kubernetes.io/worker: "" <3>
maxUnavailable: 3 <4>
desiredState:
interfaces:
- name: br1
description: Linux bridge with eth1 as a port <5>
type: linux-bridge
state: up
ipv4:
dhcp: true
enabled: true
auto-dns: false
bridge:
options:
stp:
enabled: false
port:
- name: eth1
dns-resolver: <6>
config:
search:
- example.com
- example.org
server:
- 8.8.8.8
----
<1> Name of the policy.
<2> Optional: If you do not include the `nodeSelector` parameter, the policy applies to all nodes in the cluster.
<3> This example uses the `node-role.kubernetes.io/worker: ""` node selector to select all worker nodes in the cluster.
<4> Optional: Specifies the maximum number of nmstate-enabled nodes that the policy configuration can be applied to concurrently. This parameter can be set to either a percentage value (string), for example, `"10%"`, or an absolute value (number), such as `3`.
<5> Optional: Human-readable description for the interface.
<6> Optional: Specifies the search and server settings for the DNS server.
. Create the node network policy:
+
[source,terminal]
----
$ oc apply -f br1-eth1-policy.yaml <1>
----
<1> File name of the node network configuration policy manifest.