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
2025-11-18 16:29:25 +01:00

77 lines
3.2 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
[role="_abstract"]
You can create an interface on nodes in the cluster by applying a `NodeNetworkConfigurationPolicy` (NNCP) 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` parameter in the `NodeNetworkConfigurationPolicy` manifest configuration file.
[NOTE]
====
If you have two nodes and you apply an NNCP manifest with the `maxUnavailable` parameter set to `50%` to these nodes, one node at a time receives the NNCP configuration. If you then introduce an additional NNCP manifest file with the `maxUnavailable` parameter set to `50%`, this NCCP is independent of the initial NNCP; this means that if both NNCP manifests apply a bad configuration to nodes, you can no longer guarantee that half of your cluster is functional.
====
.Prerequisites
* You have installed the {oc-first}.
.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.