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-removing-interface-from-nodes.adoc
2025-11-18 16:29:25 +01:00

67 lines
2.8 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-removing-interface-from-nodes_{context}"]
= Removing an interface from nodes
[role="_abstract"]
You can remove an interface from one or more nodes in the cluster by editing the `NodeNetworkConfigurationPolicy` object and setting the `state` of the interface to `absent`.
Removing an interface from a node does not automatically restore the node network configuration to a previous state. If you want to restore the previous state, you will need to define that node network configuration in the policy.
If you remove a bridge or bonding interface, any node NICs in the cluster that were previously attached or subordinate to that bridge or bonding interface are placed in a `down` state and become unreachable. To avoid losing connectivity, configure the node NIC in the same policy so that it has a status of `up` and either DHCP or a static IP address.
[NOTE]
====
Deleting the node network policy that added an interface does not change the configuration of the policy on the node. Although a `NodeNetworkConfigurationPolicy` is an object in the cluster, the object only represents the requested configuration. Similarly, removing an interface does not delete the policy.
====
.Prerequisites
* You have installed the {oc-first}.
.Procedure
. Update the `NodeNetworkConfigurationPolicy` manifest used to create the interface. The following example removes a Linux bridge and configures the `eth1` NIC with DHCP to avoid losing connectivity:
+
[source,yaml]
----
apiVersion: nmstate.io/v1
kind: NodeNetworkConfigurationPolicy
metadata:
name: <br1-eth1-policy> <1>
spec:
nodeSelector: <2>
node-role.kubernetes.io/worker: "" <3>
desiredState:
interfaces:
- name: br1
type: linux-bridge
state: absent <4>
- name: eth1 <5>
type: ethernet <6>
state: up <7>
ipv4:
dhcp: true <8>
enabled: true <9>
----
<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> Changing the state to `absent` removes the interface.
<5> The name of the interface that is to be unattached from the bridge interface.
<6> The type of interface. This example creates an Ethernet networking interface.
<7> The requested state for the interface.
<8> Optional: If you do not use `dhcp`, you can either set a static IP or leave the interface without an IP address.
<9> Enables `ipv4` in this example.
. Update the policy on the node and remove the interface:
+
[source,terminal]
----
$ oc apply -f <br1-eth1-policy.yaml> <1>
----
<1> File name of the policy manifest.