diff --git a/content/README.md b/content/README.md index dcc0a0bc..9e0dfe65 100644 --- a/content/README.md +++ b/content/README.md @@ -24,6 +24,7 @@ and benefit from the expertise shared in this repository. |Date|Headline| |---|---| +|2026-07-03|[Updated KubeVirt networking: OVN-Bridge, Linux-Bridge, ClusterUserDefinedNetwork](kubevirt/networking/)| |2026-05-29|[Updated disconnected installation section](cluster-installation/disconnected/)| |2026-05-26|[Added Hosted Control Plane and tenant networking](cluster-installation/hosted-control-plane/tenant-network/)| |2026-05-05|[Added cluster-installation on STACKIT](cluster-installation/stackit/)| diff --git a/content/kubevirt/networking/318_OpenShift_Virtualization_Networking_0423.png b/content/kubevirt/networking/318_OpenShift_Virtualization_Networking_0423.png new file mode 100644 index 00000000..5b455f05 Binary files /dev/null and b/content/kubevirt/networking/318_OpenShift_Virtualization_Networking_0423.png differ diff --git a/content/kubevirt/networking/bonding-vlan-localnet-bridge.drawio b/content/kubevirt/networking/bonding-vlan-localnet-bridge.drawio deleted file mode 100644 index e80d30c7..00000000 --- a/content/kubevirt/networking/bonding-vlan-localnet-bridge.drawio +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content/kubevirt/networking/diagram.drawio b/content/kubevirt/networking/diagram.drawio new file mode 100644 index 00000000..348f2b9b --- /dev/null +++ b/content/kubevirt/networking/diagram.drawio @@ -0,0 +1,393 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/content/kubevirt/networking/index.md b/content/kubevirt/networking/index.md index c779f91b..2108a5d8 100644 --- a/content/kubevirt/networking/index.md +++ b/content/kubevirt/networking/index.md @@ -2,20 +2,20 @@ title: Networking linktitle: Networking weight: 14100 -description: TBD +description: OpenShift Virtualization networking configuration including bonds, bridges, VLANs, OVS, SR-IOV, and secondary networks for VMs. icon: material/tournament -tags: ['v4.17','cnv', 'kubevirt','ocp-v','networking'] +tags: ['v4.22','cnv', 'kubevirt','ocp-v','networking'] --- # Networking An OpenShift cluster is configured using an overlay software-defined network (SDN) for both the Pod and Service networks. By default, VMs are configured with connectivity to the SDN and have the same features/connectivity as Pod-based applications. -Host-level networking configurations are created and applied using the NMstate operator. This includes the ability to report the current configuration options, such as bonds, bridges, and VLAN tags to help segregate networking resources, as well as apply desired-state configuration for those entities. +Host-level networking is configured for the primary interface during installation (br-0/SDN). All additional networks can be configured via the NMState operator. -* *Source: [Red Hat Architecting OpenShift Virtualization](https://redhatquickcourses.github.io/architect-the-ocpvirt/Red%20Hat%20OpenShift%20Virtualization%20-%20Architecting%20OpenShift%20Virtualization/1/chapter5/section2.html)* +* *Source: [OpenShift Virtualization, 10.1. Networking overview](https://docs.redhat.com/en/documentation/openshift_container_platform/4.22/html/virtualization/networking#virt-networking)* -![network_bond](network_bond.png) +![network_bond](318_OpenShift_Virtualization_Networking_0423.png) ## Bonded NICs for Management and SDN @@ -25,7 +25,13 @@ The initial bond interface, consisting of two adapters bonded together with an I The following is a sample NMstate configuration making use of two adapters on the host to create a bonded interface in the LACP (802.3ad) run mode. The bonds are intended to be used for isolating network traffic for different purposes. This provides the advantage of avoiding noisy neighbor scenarios for some interfaces that may have a large impact, for example a backup for a virtual machine consuming significant network throughput impacting ODF or etcd traffic on a shared interface. -```yaml +!!! warning + + Keep in mind, `NodeNetworkConfigurationPolicy` following not the typical Kubernetes declarative way. If you delete the following `NodeNetworkConfigurationPolicy` the bond1 for example will not be deleted. + + To remove the `bond1` from the nodes, you have to change the `state` from `up` to `absent`. + +```yaml title="Node configuration, for bond1 (LACP)" apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: @@ -35,34 +41,51 @@ metadata: spec: desiredState: interfaces: - - link-aggregation: + - name: bond1 + state: up + type: bond + link-aggregation: mode: 802.3ad port: - enp6s0f0 - enp6s0f1 - name: bond1 - state: up - type: bond ``` -## Example VM Network Configuration +## OVN-Bridge vs Linux-Bridge + +[10.1.3.1. Comparing Linux bridge CNI and OVN-Kubernetes localnet topology](https://docs.redhat.com/en/documentation/openshift_container_platform/4.22/html/virtualization/networking#virt-nw-overview-comparing-localnet-linuxbridge_virt-networking-overview) + +## OVN-Bridge example + +|Component|Version| +|---|---| +|OpenShift|v4.22.1| An example configuration for VM network connectivity is below, note that the bond configuration should be a part of the same NodeNetworkConfigurationPolicy to ensure they are configured together. -```yaml +![](diagram.drawio){ page="physnet-ovs-br1-bond1" } + +```yaml title="Node configuration, for bond1, ovs-bridge (ovs-br1) and localnet (physnet-ovs-br1-bond1)" apiVersion: nmstate.io/v1 kind: NodeNetworkConfigurationPolicy metadata: - name: ovs-br1-vlan-trunk + annotations: + description: Localnet, OVS Bridge and bond1 + name: physnet-ovs-br1-bond1 spec: nodeSelector: node-role.kubernetes.io/worker: '' desiredState: interfaces: + - name: bond1 + state: up + type: bond + link-aggregation: + mode: active-backup + port: + - eth2 + - eth3 - name: ovs-br1 - description: |- - A dedicated OVS bridge with bond2 as a port - allowing all VLANs and untagged traffic type: ovs-bridge state: up bridge: @@ -70,184 +93,118 @@ spec: options: stp: true port: - - name: bond2 + - name: bond1 ovn: bridge-mappings: - - localnet: vlan-2024 - bridge: ovs-br1 - state: present - - localnet: vlan-1993 + - localnet: physnet-ovs-br1-bond1 bridge: ovs-br1 state: present ---- -apiVersion: k8s.cni.cncf.io/v1 -kind: NetworkAttachmentDefinition -metadata: - annotations: - description: VLAN 2024 connection for VMs - name: vlan-2024 - namespace: default -spec: - config: |- - { - "cniVersion": "0.3.1", - "name": "vlan-2024", - "type": "ovn-k8s-cni-overlay", - "topology": "localnet", - "netAttachDefName": "default/vlan-2024", - "vlanID": 2024, - "ipam": {} - } ---- -apiVersion: k8s.cni.cncf.io/v1 -kind: NetworkAttachmentDefinition +``` + +### Project/namespace configuration for OVN-Bridge + +To allow virtual machines to connect to a specific VLAN. + +!!! info + + **Since OpenShift 4.19, `ClusterUserDefinedNetwork` — supports Localnet topology.** + It's not needed anymore to create `NetworkAttachmentDefinitions` by hand. + +```yaml +apiVersion: k8s.ovn.org/v1 +kind: ClusterUserDefinedNetwork metadata: annotations: - description: VLAN 1993 connection for VMs - name: vlan-1993 - namespace: default + description: Localnet, OVS Bridge and bond1 + name: net-default-vlan-10 spec: - config: |- - { - "cniVersion": "0.3.1", - "name": "vlan-1993", - "type": "ovn-k8s-cni-overlay", - "topology": "localnet", - "netAttachDefName": "default/vlan-1993", - "vlanID": 1993, - "ipam": {} - } + namespaceSelector: + matchLabels: + openshift.pub/access-to-vlan: "11" + # kubernetes.io/metadata.name: + network: + localnet: + ipam: + mode: Disabled + mtu: 1500 + physicalNetworkName: physnet-ovs-br1-bond1 + role: Secondary + vlan: + access: + id: 11 + mode: Access + topology: Localnet ``` -## Create a bridge on the main interface +## Linux-Bridge example -All nodes on which the configuration is executed are restarted. +|Component|Version| +|---|---| +|OpenShift|v4.22.1| -```yaml -oc apply -f - < VLAN -> LocalNet & Bridge * Tested with OpenShift 4.17.11 -![bonding-vlan-localnet-bridge](bonding-vlan-localnet-bridge.drawio) +![](diagram.drawio){ page="bonding-vlan-localnet-bridge" } ??? quote "NMState for initial setup / add-node" @@ -346,7 +303,7 @@ oc new-project localnet-demo * Tested with OpenShift 4.18.13 -![bond-balance-slb](bond-balance-slb.drawio) +![](diagram.drawio){ page="bond-balance-slb" } !!! WARNING diff --git a/content/kubevirt/networking/localnet-net-attach-def.yaml b/content/kubevirt/networking/localnet-net-attach-def.yaml deleted file mode 100644 index aa9d4a35..00000000 --- a/content/kubevirt/networking/localnet-net-attach-def.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: k8s.cni.cncf.io/v1 -kind: NetworkAttachmentDefinition -metadata: - name: coe - namespace: localnet-demo -spec: - config: '{ - "name":"localnet-coe", - "type":"ovn-k8s-cni-overlay", - "cniVersion":"0.4.0", - "topology":"localnet", - "netAttachDefName":"localnet-demo/coe" - }' diff --git a/content/kubevirt/networking/localnet-nncp.yaml b/content/kubevirt/networking/localnet-nncp.yaml deleted file mode 100644 index 4ed7e3af..00000000 --- a/content/kubevirt/networking/localnet-nncp.yaml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: nmstate.io/v1 -kind: NodeNetworkConfigurationPolicy -metadata: - name: localnet-coe -spec: - nodeSelector: - node-role.kubernetes.io/worker: '' - desiredState: - ovn: - bridge-mappings: - - localnet: localnet-coe - bridge: br-ex - state: present