Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 8. Networking
8.1. Networking overview Link kopierenLink in die Zwischenablage kopiert!
OpenShift Virtualization provides advanced networking functionality by using custom resources and plugins. Virtual machines (VMs) are integrated with OpenShift Container Platform networking and its ecosystem.
8.1.1. OpenShift Virtualization networking glossary Link kopierenLink in die Zwischenablage kopiert!
The following terms are used throughout OpenShift Virtualization documentation:
- Container Network Interface (CNI)
- A Cloud Native Computing Foundation project, focused on container network connectivity. OpenShift Virtualization uses CNI plugins to build upon the basic Kubernetes networking functionality.
- Multus
- A "meta" CNI plugin that allows multiple CNIs to exist so that a pod or virtual machine can use the interfaces it needs.
- Custom resource definition (CRD)
- A Kubernetes API resource that allows you to define custom resources, or an object defined by using the CRD API resource.
- Network attachment definition (NAD)
- A CRD introduced by the Multus project that allows you to attach pods, virtual machines, and virtual machine instances to one or more networks.
- Node network configuration policy (NNCP)
-
A CRD introduced by the nmstate project, describing the requested network configuration on nodes. You update the node network configuration, including adding and removing interfaces, by applying a
NodeNetworkConfigurationPolicy
manifest to the cluster.
8.1.2. Using the default pod network Link kopierenLink in die Zwischenablage kopiert!
- Connecting a virtual machine to the default pod network
- Each VM is connected by default to the default internal pod network. You can add or remove network interfaces by editing the VM specification.
- Exposing a virtual machine as a service
-
You can expose a VM within the cluster or outside the cluster by creating a
Service
object. For on-premise clusters, you can configure a load balancing service by using the MetalLB Operator. You can install the MetalLB Operator by using the OpenShift Container Platform web console or the CLI.
8.1.3. Configuring VM secondary network interfaces Link kopierenLink in die Zwischenablage kopiert!
- Connecting a virtual machine to a Linux bridge network
Install the Kubernetes NMState Operator to configure Linux bridges, VLANs, and bondings for your secondary networks.
You can create a Linux bridge network and attach a VM to the network by performing the following steps:
-
Configure a Linux bridge network device by creating a
NodeNetworkConfigurationPolicy
custom resource definition (CRD). -
Configure a Linux bridge network by creating a
NetworkAttachmentDefinition
CRD. - Connect the VM to the Linux bridge network by including the network details in the VM configuration.
-
Configure a Linux bridge network device by creating a
- Connecting a virtual machine to an SR-IOV network
You can use Single Root I/O Virtualization (SR-IOV) network devices with additional networks on your OpenShift Container Platform cluster installed on bare metal or Red Hat OpenStack Platform (RHOSP) infrastructure for applications that require high bandwidth or low latency.
You must install the SR-IOV Network Operator on your cluster to manage SR-IOV network devices and network attachments.
You can connect a VM to an SR-IOV network by performing the following steps:
-
Configure an SR-IOV network device by creating a
SriovNetworkNodePolicy
CRD. -
Configure an SR-IOV network by creating an
SriovNetwork
object. - Connect the VM to the SR-IOV network by including the network details in the VM configuration.
-
Configure an SR-IOV network device by creating a
- Connecting a virtual machine to an OVN-Kubernetes secondary network
You can connect a VM to an Open Virtual Network (OVN)-Kubernetes secondary network. To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps:
-
Configure an OVN-Kubernetes secondary network by creating a
NetworkAttachmentDefinition
CRD. - Connect the VM to the OVN-Kubernetes secondary network by adding the network details to the VM specification.
-
Configure an OVN-Kubernetes secondary network by creating a
- Hot plugging secondary network interfaces
- You can add or remove secondary network interfaces without stopping your VM. OpenShift Virtualization supports hot plugging and hot unplugging for Linux bridge interfaces that use the VirtIO device driver.
- Using DPDK with SR-IOV
- The Data Plane Development Kit (DPDK) provides a set of libraries and drivers for fast packet processing. You can configure clusters and VMs to run DPDK workloads over SR-IOV networks.
- Configuring a dedicated network for live migration
- You can configure a dedicated Multus network for live migration. A dedicated network minimizes the effects of network saturation on tenant workloads during live migration.
- Accessing a virtual machine by using the cluster FQDN
- You can access a VM that is attached to a secondary network interface from outside the cluster by using its fully qualified domain name (FQDN).
- Configuring and viewing IP addresses
- You can configure an IP address of a secondary network interface when you create a VM. The IP address is provisioned with cloud-init. You can view the IP address of a VM by using the OpenShift Container Platform web console or the command line. The network information is collected by the QEMU guest agent.
8.1.4. Integrating with OpenShift Service Mesh Link kopierenLink in die Zwischenablage kopiert!
- Connecting a virtual machine to a service mesh
- OpenShift Virtualization is integrated with OpenShift Service Mesh. You can monitor, visualize, and control traffic between pods and virtual machines.
8.1.5. Managing MAC address pools Link kopierenLink in die Zwischenablage kopiert!
- Managing MAC address pools for network interfaces
- The KubeMacPool component allocates MAC addresses for VM network interfaces from a shared MAC address pool. This ensures that each network interface is assigned a unique MAC address. A virtual machine instance created from that VM retains the assigned MAC address across reboots.
8.1.6. Configuring SSH access Link kopierenLink in die Zwischenablage kopiert!
- Configuring SSH access to virtual machines
You can configure SSH access to VMs by using the following methods:
You create an SSH key pair, add the public key to a VM, and connect to the VM by running the
virtctl ssh
command with the private key.You can add public SSH keys to Red Hat Enterprise Linux (RHEL) 9 VMs at runtime or at first boot to VMs with guest operating systems that can be configured by using a cloud-init data source.
You add the
virtctl port-foward
command to your.ssh/config
file and connect to the VM by using OpenSSH.You create a service, associate the service with the VM, and connect to the IP address and port exposed by the service.
You configure a secondary network, attach a VM to the secondary network interface, and connect to its allocated IP address.
8.2. Connecting a virtual machine to the default pod network Link kopierenLink in die Zwischenablage kopiert!
You can connect a virtual machine to the default internal pod network by configuring its network interface to use the masquerade
binding mode.
Traffic passing through network interfaces to the default pod network is interrupted during live migration.
8.2.1. Configuring masquerade mode from the command line Link kopierenLink in die Zwischenablage kopiert!
You can use masquerade mode to hide a virtual machine’s outgoing traffic behind the pod IP address. Masquerade mode uses Network Address Translation (NAT) to connect virtual machines to the pod network backend through a Linux bridge.
Enable masquerade mode and allow traffic to enter the virtual machine by editing your virtual machine configuration file.
Prerequisites
- The virtual machine must be configured to use DHCP to acquire IPv4 addresses.
Procedure
Edit the
interfaces
spec of your virtual machine configuration file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Connect using masquerade mode.
- 2
- Optional: List the ports that you want to expose from the virtual machine, each specified by the
port
field. Theport
value must be a number between 0 and 65536. When theports
array is not used, all ports in the valid range are open to incoming traffic. In this example, incoming traffic is allowed on port80
.
NotePorts 49152 and 49153 are reserved for use by the libvirt platform and all other incoming traffic to these ports is dropped.
Create the virtual machine:
oc create -f <vm-name>.yaml
$ oc create -f <vm-name>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.2.2. Configuring masquerade mode with dual-stack (IPv4 and IPv6) Link kopierenLink in die Zwischenablage kopiert!
You can configure a new virtual machine (VM) to use both IPv6 and IPv4 on the default pod network by using cloud-init.
The Network.pod.vmIPv6NetworkCIDR
field in the virtual machine instance configuration determines the static IPv6 address of the VM and the gateway IP address. These are used by the virt-launcher pod to route IPv6 traffic to the virtual machine and are not used externally. The Network.pod.vmIPv6NetworkCIDR
field specifies an IPv6 address block in Classless Inter-Domain Routing (CIDR) notation. The default value is fd10:0:2::2/120
. You can edit this value based on your network requirements.
When the virtual machine is running, incoming and outgoing traffic for the virtual machine is routed to both the IPv4 address and the unique IPv6 address of the virt-launcher pod. The virt-launcher pod then routes the IPv4 traffic to the DHCP address of the virtual machine, and the IPv6 traffic to the statically set IPv6 address of the virtual machine.
Prerequisites
- The OpenShift Container Platform cluster must use the OVN-Kubernetes Container Network Interface (CNI) network plugin configured for dual-stack.
Procedure
In a new virtual machine configuration, include an interface with
masquerade
and configure the IPv6 address and default gateway by using cloud-init.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Connect using masquerade mode.
- 2
- Allows incoming traffic on port 80 to the virtual machine.
- 3
- The static IPv6 address as determined by the
Network.pod.vmIPv6NetworkCIDR
field in the virtual machine instance configuration. The default value isfd10:0:2::2/120
. - 4
- The gateway IP address as determined by the
Network.pod.vmIPv6NetworkCIDR
field in the virtual machine instance configuration. The default value isfd10:0:2::1
.
Create the virtual machine in the namespace:
oc create -f example-vm-ipv6.yaml
$ oc create -f example-vm-ipv6.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
- To verify that IPv6 has been configured, start the virtual machine and view the interface status of the virtual machine instance to ensure it has an IPv6 address:
oc get vmi <vmi-name> -o jsonpath="{.status.interfaces[*].ipAddresses}"
$ oc get vmi <vmi-name> -o jsonpath="{.status.interfaces[*].ipAddresses}"
8.2.3. About jumbo frames support Link kopierenLink in die Zwischenablage kopiert!
When using the OVN-Kubernetes CNI plugin, you can send unfragmented jumbo frame packets between two virtual machines (VMs) that are connected on the default pod network. Jumbo frames have a maximum transmission unit (MTU) value greater than 1500 bytes.
The VM automatically gets the MTU value of the cluster network, set by the cluster administrator, in one of the following ways:
-
libvirt
: If the guest OS has the latest version of the VirtIO driver that can interpret incoming data via a Peripheral Component Interconnect (PCI) config register in the emulated device. - DHCP: If the guest DHCP client can read the MTU value from the DHCP server response.
For Windows VMs that do not have a VirtIO driver, you must set the MTU manually by using netsh
or a similar tool. This is because the Windows DHCP client does not read the MTU value.
8.3. Exposing a virtual machine by using a service Link kopierenLink in die Zwischenablage kopiert!
You can expose a virtual machine within the cluster or outside the cluster by creating a Service
object.
8.3.1. About services Link kopierenLink in die Zwischenablage kopiert!
A Kubernetes service exposes network access for clients to an application running on a set of pods. Services offer abstraction, load balancing, and, in the case of the NodePort
and LoadBalancer
types, exposure to the outside world.
- ClusterIP
-
Exposes the service on an internal IP address and as a DNS name to other applications within the cluster. A single service can map to multiple virtual machines. When a client tries to connect to the service, the client’s request is load balanced among available backends.
ClusterIP
is the default service type. - NodePort
-
Exposes the service on the same port of each selected node in the cluster.
NodePort
makes a port accessible from outside the cluster, as long as the node itself is externally accessible to the client. - LoadBalancer
- Creates an external load balancer in the current cloud (if supported) and assigns a fixed, external IP address to the service.
For on-premise clusters, you can configure a load-balancing service by deploying the MetalLB Operator.
8.3.2. Dual-stack support Link kopierenLink in die Zwischenablage kopiert!
If IPv4 and IPv6 dual-stack networking is enabled for your cluster, you can create a service that uses IPv4, IPv6, or both, by defining the spec.ipFamilyPolicy
and the spec.ipFamilies
fields in the Service
object.
The spec.ipFamilyPolicy
field can be set to one of the following values:
- SingleStack
- The control plane assigns a cluster IP address for the service based on the first configured service cluster IP range.
- PreferDualStack
- The control plane assigns both IPv4 and IPv6 cluster IP addresses for the service on clusters that have dual-stack configured.
- RequireDualStack
-
This option fails for clusters that do not have dual-stack networking enabled. For clusters that have dual-stack configured, the behavior is the same as when the value is set to
PreferDualStack
. The control plane allocates cluster IP addresses from both IPv4 and IPv6 address ranges.
You can define which IP family to use for single-stack or define the order of IP families for dual-stack by setting the spec.ipFamilies
field to one of the following array values:
-
[IPv4]
-
[IPv6]
-
[IPv4, IPv6]
-
[IPv6, IPv4]
8.3.3. Creating a service by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can create a service and associate it with a virtual machine (VM) by using the command line.
Prerequisites
- You configured the cluster network to support the service.
Procedure
Edit the
VirtualMachine
manifest to add the label for service creation:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Add
special: key
to thespec.template.metadata.labels
stanza.
NoteLabels on a virtual machine are passed through to the pod. The
special: key
label must match the label in thespec.selector
attribute of theService
manifest.-
Save the
VirtualMachine
manifest file to apply your changes. Create a
Service
manifest to expose the VM:Copy to Clipboard Copied! Toggle word wrap Toggle overflow -
Save the
Service
manifest file. Create the service by running the following command:
oc create -f example-service.yaml
$ oc create -f example-service.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the VM to apply the changes.
Verification
Query the
Service
object to verify that it is available:oc get service -n example-namespace
$ oc get service -n example-namespace
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.4. Connecting a virtual machine to a Linux bridge network Link kopierenLink in die Zwischenablage kopiert!
By default, OpenShift Virtualization is installed with a single, internal pod network.
You can create a Linux bridge network and attach a virtual machine (VM) to the network by performing the following steps:
- Create a Linux bridge node network configuration policy (NNCP).
- Create a Linux bridge network attachment definition (NAD) by using the web console or the command line.
- Configure the VM to recognize the NAD by using the web console or the command line.
OpenShift Virtualization does not support Linux bridge bonding modes 0, 5, and 6. For more information, see Which bonding modes work when used with a bridge that virtual machine guests or containers connect to?.
8.4.1. Creating a Linux bridge NNCP Link kopierenLink in die Zwischenablage kopiert!
You can create a NodeNetworkConfigurationPolicy
(NNCP) manifest for a Linux bridge network.
Prerequisites
- You have installed the Kubernetes NMState Operator.
Procedure
Create the
NodeNetworkConfigurationPolicy
manifest. This example includes sample values that you must replace with your own information.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Name of the policy.
- 2
- Name of the interface.
- 3
- Optional: Human-readable description of the interface.
- 4
- The type of interface. This example creates a bridge.
- 5
- The requested state for the interface after creation.
- 6
- Disables IPv4 in this example.
- 7
- Disables STP in this example.
- 8
- The node NIC to which the bridge is attached.
8.4.2. Creating a Linux bridge NAD Link kopierenLink in die Zwischenablage kopiert!
You can create a Linux bridge network attachment definition (NAD) by using the OpenShift Container Platform web console or command line.
8.4.2.1. Creating a Linux bridge NAD by using the web console Link kopierenLink in die Zwischenablage kopiert!
You can create a network attachment definition (NAD) to provide layer-2 networking to pods and virtual machines by using the OpenShift Container Platform web console.
A Linux bridge network attachment definition is the most efficient method for connecting a virtual machine to a VLAN.
Configuring IP address management (IPAM) in a network attachment definition for virtual machines is not supported.
Procedure
-
In the web console, click Networking
NetworkAttachmentDefinitions. Click Create Network Attachment Definition.
NoteThe network attachment definition must be in the same namespace as the pod or virtual machine.
- Enter a unique Name and optional Description.
- Select CNV Linux bridge from the Network Type list.
- Enter the name of the bridge in the Bridge Name field.
- Optional: If the resource has VLAN IDs configured, enter the ID numbers in the VLAN Tag Number field.
- Optional: Select MAC Spoof Check to enable MAC spoof filtering. This feature provides security against a MAC spoofing attack by allowing only a single MAC address to exit the pod.
- Click Create.
8.4.2.2. Creating a Linux bridge NAD by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can create a network attachment definition (NAD) to provide layer-2 networking to pods and virtual machines (VMs) by using the command line.
The NAD and the VM must be in the same namespace.
Configuring IP address management (IPAM) in a network attachment definition for virtual machines is not supported.
Prerequisites
-
The node must support nftables and the
nft
binary must be deployed to enable MAC spoof check.
Procedure
Add the VM to the
NetworkAttachmentDefinition
configuration, as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name for the
NetworkAttachmentDefinition
object. - 2
- Optional: Annotation key-value pair for node selection for the bridge configured on some nodes. If you add this annotation to your network attachment definition, your virtual machine instances will only run on the nodes that have the defined bridge connected.
- 3
- The name for the configuration. It is recommended to match the configuration name to the
name
value of the network attachment definition. - 4
- The actual name of the Container Network Interface (CNI) plugin that provides the network for this network attachment definition. Do not change this field unless you want to use a different CNI.
- 5
- The name of the Linux bridge configured on the node. The name should match the interface bridge name defined in the
NodeNetworkConfigurationPolicy
manifest. - 6
- Optional: A flag to enable the MAC spoof check. When set to
true
, you cannot change the MAC address of the pod or guest interface. This attribute allows only a single MAC address to exit the pod, which provides security against a MAC spoofing attack. - 7
- Optional: The VLAN tag. No additional VLAN configuration is required on the node network configuration policy.
- 8
- Optional: Indicates whether the VM connects to the bridge through the default VLAN. The default value is
true
.
NoteA Linux bridge network attachment definition is the most efficient method for connecting a virtual machine to a VLAN.
Create the network attachment definition:
oc create -f network-attachment-definition.yaml
$ oc create -f network-attachment-definition.yaml
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Where
network-attachment-definition.yaml
is the file name of the network attachment definition manifest.
Verification
Verify that the network attachment definition was created by running the following command:
oc get network-attachment-definition bridge-network
$ oc get network-attachment-definition bridge-network
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.4.3. Configuring a VM network interface Link kopierenLink in die Zwischenablage kopiert!
You can configure a virtual machine (VM) network interface by using the OpenShift Container Platform web console or command line.
8.4.3.1. Configuring a VM network interface by using the web console Link kopierenLink in die Zwischenablage kopiert!
You can configure a network interface for a virtual machine (VM) by using the OpenShift Container Platform web console.
Prerequisites
- You created a network attachment definition for the network.
Procedure
-
Navigate to Virtualization
VirtualMachines. - Click a VM to view the VirtualMachine details page.
- On the Configuration tab, click the Network interfaces tab.
- Click Add network interface.
- Enter the interface name and select the network attachment definition from the Network list.
- Click Save.
- Restart the VM to apply the changes.
Networking fields
Name | Description |
---|---|
Name | Name for the network interface controller. |
Model | Indicates the model of the network interface controller. Supported values are e1000e and virtio. |
Network | List of available network attachment definitions. |
Type | List of available binding methods. Select the binding method suitable for the network interface:
|
MAC Address | MAC address for the network interface controller. If a MAC address is not specified, one is assigned automatically. |
8.4.3.2. Configuring a VM network interface by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can configure a virtual machine (VM) network interface for a bridge network by using the command line.
Prerequisites
- Shut down the virtual machine before editing the configuration. If you edit a running virtual machine, you must restart the virtual machine for the changes to take effect.
Procedure
Add the bridge interface and the network attachment definition to the VM configuration as in the following example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the configuration:
oc apply -f example-vm.yaml
$ oc apply -f example-vm.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional: If you edited a running virtual machine, you must restart it for the changes to take effect.
8.5. Connecting a virtual machine to an SR-IOV network Link kopierenLink in die Zwischenablage kopiert!
You can connect a virtual machine (VM) to a Single Root I/O Virtualization (SR-IOV) network by performing the following steps:
8.5.1. Configuring SR-IOV network devices Link kopierenLink in die Zwischenablage kopiert!
The SR-IOV Network Operator adds the SriovNetworkNodePolicy.sriovnetwork.openshift.io
CustomResourceDefinition to OpenShift Container Platform. You can configure an SR-IOV network device by creating a SriovNetworkNodePolicy custom resource (CR).
When applying the configuration specified in a SriovNetworkNodePolicy
object, the SR-IOV Operator might drain the nodes, and in some cases, reboot nodes.
It might take several minutes for a configuration change to apply.
Prerequisites
-
You installed the OpenShift CLI (
oc
). -
You have access to the cluster as a user with the
cluster-admin
role. - You have installed the SR-IOV Network Operator.
- You have enough available nodes in your cluster to handle the evicted workload from drained nodes.
- You have not selected any control plane nodes for SR-IOV network device configuration.
Procedure
Create an
SriovNetworkNodePolicy
object, and then save the YAML in the<name>-sriov-node-network.yaml
file. Replace<name>
with the name for this configuration.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify a name for the CR object.
- 2
- Specify the namespace where the SR-IOV Operator is installed.
- 3
- Specify the resource name of the SR-IOV device plugin. You can create multiple
SriovNetworkNodePolicy
objects for a resource name. - 4
- Specify the node selector to select which nodes are configured. Only SR-IOV network devices on selected nodes are configured. The SR-IOV Container Network Interface (CNI) plugin and device plugin are deployed only on selected nodes.
- 5
- Optional: Specify an integer value between
0
and99
. A smaller number gets higher priority, so a priority of10
is higher than a priority of99
. The default value is99
. - 6
- Optional: Specify a value for the maximum transmission unit (MTU) of the virtual function. The maximum MTU value can vary for different NIC models.
- 7
- Specify the number of the virtual functions (VF) to create for the SR-IOV physical network device. For an Intel network interface controller (NIC), the number of VFs cannot be larger than the total VFs supported by the device. For a Mellanox NIC, the number of VFs cannot be larger than
127
. - 8
- The
nicSelector
mapping selects the Ethernet device for the Operator to configure. You do not need to specify values for all the parameters. It is recommended to identify the Ethernet adapter with enough precision to minimize the possibility of selecting an Ethernet device unintentionally. If you specifyrootDevices
, you must also specify a value forvendor
,deviceID
, orpfNames
. If you specify bothpfNames
androotDevices
at the same time, ensure that they point to an identical device. - 9
- Optional: Specify the vendor hex code of the SR-IOV network device. The only allowed values are either
8086
or15b3
. - 10
- Optional: Specify the device hex code of SR-IOV network device. The only allowed values are
158b
,1015
,1017
. - 11
- Optional: The parameter accepts an array of one or more physical function (PF) names for the Ethernet device.
- 12
- The parameter accepts an array of one or more PCI bus addresses for the physical function of the Ethernet device. Provide the address in the following format:
0000:02:00.1
. - 13
- The
vfio-pci
driver type is required for virtual functions in OpenShift Virtualization. - 14
- Optional: Specify whether to enable remote direct memory access (RDMA) mode. For a Mellanox card, set
isRdma
tofalse
. The default value isfalse
.
NoteIf
isRDMA
flag is set totrue
, you can continue to use the RDMA enabled VF as a normal network device. A device can be used in either mode.-
Optional: Label the SR-IOV capable cluster nodes with
SriovNetworkNodePolicy.Spec.NodeSelector
if they are not already labeled. For more information about labeling nodes, see "Understanding how to update labels on nodes". Create the
SriovNetworkNodePolicy
object:oc create -f <name>-sriov-node-network.yaml
$ oc create -f <name>-sriov-node-network.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where
<name>
specifies the name for this configuration.After applying the configuration update, all the pods in
sriov-network-operator
namespace transition to theRunning
status.To verify that the SR-IOV network device is configured, enter the following command. Replace
<node_name>
with the name of a node with the SR-IOV network device that you just configured.oc get sriovnetworknodestates -n openshift-sriov-network-operator <node_name> -o jsonpath='{.status.syncStatus}'
$ oc get sriovnetworknodestates -n openshift-sriov-network-operator <node_name> -o jsonpath='{.status.syncStatus}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.2. Configuring SR-IOV additional network Link kopierenLink in die Zwischenablage kopiert!
You can configure an additional network that uses SR-IOV hardware by creating an SriovNetwork
object.
When you create an SriovNetwork
object, the SR-IOV Network Operator automatically creates a NetworkAttachmentDefinition
object.
Do not modify or delete an SriovNetwork
object if it is attached to pods or virtual machines in a running
state.
Prerequisites
-
Install the OpenShift CLI (
oc
). -
Log in as a user with
cluster-admin
privileges.
Procedure
-
Create the following
SriovNetwork
object, and then save the YAML in the<name>-sriov-network.yaml
file. Replace<name>
with a name for this additional network.
- 1
- Replace
<name>
with a name for the object. The SR-IOV Network Operator creates aNetworkAttachmentDefinition
object with same name. - 2
- Specify the namespace where the SR-IOV Network Operator is installed.
- 3
- Replace
<sriov_resource_name>
with the value for the.spec.resourceName
parameter from theSriovNetworkNodePolicy
object that defines the SR-IOV hardware for this additional network. - 4
- Replace
<target_namespace>
with the target namespace for the SriovNetwork. Only pods or virtual machines in the target namespace can attach to the SriovNetwork. - 5
- Optional: Replace
<vlan>
with a Virtual LAN (VLAN) ID for the additional network. The integer value must be from0
to4095
. The default value is0
. - 6
- Optional: Replace
<spoof_check>
with the spoof check mode of the VF. The allowed values are the strings"on"
and"off"
.ImportantYou must enclose the value you specify in quotes or the CR is rejected by the SR-IOV Network Operator.
- 7
- Optional: Replace
<link_state>
with the link state of virtual function (VF). Allowed value areenable
,disable
andauto
. - 8
- Optional: Replace
<max_tx_rate>
with a maximum transmission rate, in Mbps, for the VF. - 9
- Optional: Replace
<min_tx_rate>
with a minimum transmission rate, in Mbps, for the VF. This value should always be less than or equal to Maximum transmission rate.NoteIntel NICs do not support the
minTxRate
parameter. For more information, see BZ#1772847. - 10
- Optional: Replace
<vlan_qos>
with an IEEE 802.1p priority level for the VF. The default value is0
. - 11
- Optional: Replace
<trust_vf>
with the trust mode of the VF. The allowed values are the strings"on"
and"off"
.ImportantYou must enclose the value you specify in quotes or the CR is rejected by the SR-IOV Network Operator.
- 12
- Optional: Replace
<capabilities>
with the capabilities to configure for this network.
To create the object, enter the following command. Replace
<name>
with a name for this additional network.oc create -f <name>-sriov-network.yaml
$ oc create -f <name>-sriov-network.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: To confirm that the
NetworkAttachmentDefinition
object associated with theSriovNetwork
object that you created in the previous step exists, enter the following command. Replace<namespace>
with the namespace you specified in theSriovNetwork
object.oc get net-attach-def -n <namespace>
$ oc get net-attach-def -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.5.3. Connecting a virtual machine to an SR-IOV network Link kopierenLink in die Zwischenablage kopiert!
You can connect the virtual machine (VM) to the SR-IOV network by including the network details in the VM configuration.
Procedure
Add the SR-IOV network details to the
spec.domain.devices.interfaces
andspec.networks
stanzas of the VM configuration as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the virtual machine configuration:
oc apply -f <vm_sriov>.yaml
$ oc apply -f <vm_sriov>.yaml
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the virtual machine YAML file.
8.6. Using DPDK with SR-IOV Link kopierenLink in die Zwischenablage kopiert!
The Data Plane Development Kit (DPDK) provides a set of libraries and drivers for fast packet processing.
You can configure clusters and virtual machines (VMs) to run DPDK workloads over SR-IOV networks.
Running DPDK workloads is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
8.6.1. Configuring a cluster for DPDK workloads Link kopierenLink in die Zwischenablage kopiert!
You can configure an OpenShift Container Platform cluster to run Data Plane Development Kit (DPDK) workloads for improved network performance.
Prerequisites
-
You have access to the cluster as a user with
cluster-admin
permissions. -
You have installed the OpenShift CLI (
oc
). - You have installed the SR-IOV Network Operator.
- You have installed the Node Tuning Operator.
Procedure
- Map your compute nodes topology to determine which Non-Uniform Memory Access (NUMA) CPUs are isolated for DPDK applications and which ones are reserved for the operating system (OS).
Label a subset of the compute nodes with a custom role; for example,
worker-dpdk
:oc label node <node_name> node-role.kubernetes.io/worker-dpdk=""
$ oc label node <node_name> node-role.kubernetes.io/worker-dpdk=""
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new
MachineConfigPool
manifest that contains theworker-dpdk
label in thespec.machineConfigSelector
object:Example
MachineConfigPool
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
PerformanceProfile
manifest that applies to the labeled nodes and the machine config pool that you created in the previous steps. The performance profile specifies the CPUs that are isolated for DPDK applications and the CPUs that are reserved for house keeping.Example
PerformanceProfile
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe compute nodes automatically restart after you apply the
MachineConfigPool
andPerformanceProfile
manifests.Retrieve the name of the generated
RuntimeClass
resource from thestatus.runtimeClass
field of thePerformanceProfile
object:oc get performanceprofiles.performance.openshift.io profile-1 -o=jsonpath='{.status.runtimeClass}{"\n"}'
$ oc get performanceprofiles.performance.openshift.io profile-1 -o=jsonpath='{.status.runtimeClass}{"\n"}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Set the previously obtained
RuntimeClass
name as the default container runtime class for thevirt-launcher
pods by editing theHyperConverged
custom resource (CR):oc patch hyperconverged kubevirt-hyperconverged -n openshift-cnv \ --type='json' -p='[{"op": "add", "path": "/spec/defaultRuntimeClass", "value":"<runtimeclass-name>"}]'
$ oc patch hyperconverged kubevirt-hyperconverged -n openshift-cnv \ --type='json' -p='[{"op": "add", "path": "/spec/defaultRuntimeClass", "value":"<runtimeclass-name>"}]'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteEditing the
HyperConverged
CR changes a global setting that affects all VMs that are created after the change is applied.Create an
SriovNetworkNodePolicy
object with thespec.deviceType
field set tovfio-pci
:Example
SriovNetworkNodePolicy
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow
8.6.2. Configuring a project for DPDK workloads Link kopierenLink in die Zwischenablage kopiert!
You can configure the project to run DPDK workloads on SR-IOV hardware.
Prerequisites
- Your cluster is configured to run DPDK workloads.
Procedure
Create a namespace for your DPDK applications:
oc create ns dpdk-checkup-ns
$ oc create ns dpdk-checkup-ns
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create an
SriovNetwork
object that references theSriovNetworkNodePolicy
object. When you create anSriovNetwork
object, the SR-IOV Network Operator automatically creates aNetworkAttachmentDefinition
object.Example
SriovNetwork
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional: Run the virtual machine latency checkup to verify that the network is properly configured.
- Optional: Run the DPDK checkup to verify that the namespace is ready for DPDK workloads.
8.6.3. Configuring a virtual machine for DPDK workloads Link kopierenLink in die Zwischenablage kopiert!
You can run Data Packet Development Kit (DPDK) workloads on virtual machines (VMs) to achieve lower latency and higher throughput for faster packet processing in the user space. DPDK uses the SR-IOV network for hardware-based I/O sharing.
Prerequisites
- Your cluster is configured to run DPDK workloads.
- You have created and configured the project in which the VM will run.
Procedure
Edit the
VirtualMachine
manifest to include information about the SR-IOV network interface, CPU topology, CRI-O annotations, and huge pages:Example
VirtualMachine
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- This annotation specifies that load balancing is disabled for CPUs that are used by the container.
- 2
- This annotation specifies that the CPU quota is disabled for CPUs that are used by the container.
- 3
- This annotation specifies that Interrupt Request (IRQ) load balancing is disabled for CPUs that are used by the container.
- 4
- The number of sockets inside the VM. This field must be set to
1
for the CPUs to be scheduled from the same Non-Uniform Memory Access (NUMA) node. - 5
- The number of cores inside the VM. This must be a value greater than or equal to
1
. In this example, the VM is scheduled with 5 hyper-threads or 10 CPUs. - 6
- The size of the huge pages. The possible values for x86-64 architecture are 1Gi and 2Mi. In this example, the request is for 8 huge pages of size 1Gi.
- 7
- The name of the SR-IOV
NetworkAttachmentDefinition
object.
- Save and exit the editor.
Apply the
VirtualMachine
manifest:oc apply -f <file_name>.yaml
$ oc apply -f <file_name>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure the guest operating system. The following example shows the configuration steps for RHEL 8 OS:
Configure huge pages by using the GRUB bootloader command-line interface. In the following example, 8 1G huge pages are specified.
grubby --update-kernel=ALL --args="default_hugepagesz=1GB hugepagesz=1G hugepages=8"
$ grubby --update-kernel=ALL --args="default_hugepagesz=1GB hugepagesz=1G hugepages=8"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To achieve low-latency tuning by using the
cpu-partitioning
profile in the TuneD application, run the following commands:dnf install -y tuned-profiles-cpu-partitioning
$ dnf install -y tuned-profiles-cpu-partitioning
Copy to Clipboard Copied! Toggle word wrap Toggle overflow echo isolated_cores=2-9 > /etc/tuned/cpu-partitioning-variables.conf
$ echo isolated_cores=2-9 > /etc/tuned/cpu-partitioning-variables.conf
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The first two CPUs (0 and 1) are set aside for house keeping tasks and the rest are isolated for the DPDK application.
tuned-adm profile cpu-partitioning
$ tuned-adm profile cpu-partitioning
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Override the SR-IOV NIC driver by using the
driverctl
device driver control utility:dnf install -y driverctl
$ dnf install -y driverctl
Copy to Clipboard Copied! Toggle word wrap Toggle overflow driverctl set-override 0000:07:00.0 vfio-pci
$ driverctl set-override 0000:07:00.0 vfio-pci
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- Restart the VM to apply the changes.
8.7. Connecting a virtual machine to an OVN-Kubernetes secondary network Link kopierenLink in die Zwischenablage kopiert!
You can connect a virtual machine (VM) to an Open Virtual Network (OVN)-Kubernetes secondary network. The OVN-Kubernetes Container Network Interface (CNI) plug-in uses the Geneve (Generic Network Virtualization Encapsulation) protocol to create an overlay network between nodes.
OpenShift Virtualization currently supports the flat layer 2 topology. This topology connects workloads by a cluster-wide logical switch. You can use this overlay network to connect VMs on different nodes, without having to configure any additional physical networking infrastructure.
To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps:
8.7.1. Creating an OVN-Kubernetes NAD Link kopierenLink in die Zwischenablage kopiert!
You can create an OVN-Kubernetes flat layer 2 network attachment definition (NAD) by using the OpenShift Container Platform web console or the CLI.
Configuring IP address management (IPAM) by specifying the spec.config.ipam.subnet
attribute in a network attachment definition for virtual machines is not supported.
8.7.1.1. Creating a NAD for flat layer 2 topology by using the CLI Link kopierenLink in die Zwischenablage kopiert!
You can create a network attachment definition (NAD) which describes how to attach a pod to the layer 2 overlay network.
Prerequisites
-
You have access to the cluster as a user with
cluster-admin
privileges. -
You have installed the OpenShift CLI (
oc
).
Procedure
Create a
NetworkAttachmentDefinition
object:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The Container Network Interface (CNI) specification version. The required value is
0.3.1
. - 2
- The name of the network. This attribute is not namespaced. For example, you can have a network named
l2-network
referenced from two differentNetworkAttachmentDefinition
objects that exist in two different namespaces. This feature is useful to connect VMs in different namespaces. - 3
- The name of the CNI plugin. The required value is
ovn-k8s-cni-overlay
. - 4
- The topological configuration for the network. The required value is
layer2
. - 5
- Optional: The maximum transmission unit (MTU) value. If you do not set a value, the Cluster Network Operator (CNO) sets a default MTU value by calculating the difference among the underlay MTU of the primary network interface, the overlay MTU of the pod network, such as the Geneve (Generic Network Virtualization Encapsulation), and byte capacity of any enabled features, such as IPsec.
- 6
- The value of the
namespace
andname
fields in themetadata
stanza of theNetworkAttachmentDefinition
object.
NoteThe previous example configures a cluster-wide overlay without a subnet defined. This means that the logical switch implementing the network only provides layer 2 communication. You must configure an IP address when you create the virtual machine by either setting a static IP address or by deploying a DHCP server on the network for a dynamic IP address.
Apply the manifest by running the following command:
oc apply -f <filename>.yaml
$ oc apply -f <filename>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.7.2. Attaching a virtual machine to the OVN-Kubernetes secondary network Link kopierenLink in die Zwischenablage kopiert!
You can attach a virtual machine (VM) to the OVN-Kubernetes secondary network interface by using the OpenShift Container Platform web console or the CLI.
8.7.2.1. Attaching a virtual machine to an OVN-Kubernetes secondary network using the CLI Link kopierenLink in die Zwischenablage kopiert!
You can connect a virtual machine (VM) to the OVN-Kubernetes secondary network by including the network details in the VM configuration.
Prerequisites
-
You have access to the cluster as a user with
cluster-admin
privileges. -
You have installed the OpenShift CLI (
oc
).
Procedure
Edit the
VirtualMachine
manifest to add the OVN-Kubernetes secondary network interface details, as in the following example:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the
VirtualMachine
manifest:oc apply -f <filename>.yaml
$ oc apply -f <filename>.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Optional: If you edited a running virtual machine, you must restart it for the changes to take effect.
8.8. Hot plugging secondary network interfaces Link kopierenLink in die Zwischenablage kopiert!
You can add or remove secondary network interfaces without stopping your virtual machine (VM). OpenShift Virtualization supports hot plugging and hot unplugging for Linux bridge interfaces that use the VirtIO device driver.
Hot plugging and hot unplugging bridge network interfaces is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
8.8.1. VirtIO limitations Link kopierenLink in die Zwischenablage kopiert!
Each VirtIO interface uses one of the limited Peripheral Connect Interface (PCI) slots in the VM. There are a total of 32 slots available. The PCI slots are also used by other devices and must be reserved in advance, therefore slots might not be available on demand. OpenShift Virtualization reserves up to four slots for hot plugging interfaces. This includes any existing plugged network interfaces. For example, if your VM has two existing plugged interfaces, you can hot plug two more network interfaces.
The actual number of slots available for hot plugging also depends on the machine type. For example, the default PCI topology for the q35 machine type supports hot plugging one additional PCIe device. For more information on PCI topology and hot plug support, see the libvirt documentation.
If you restart the VM after hot plugging an interface, that interface becomes part of the standard network interfaces.
8.8.2. Hot plugging a bridge network interface using the CLI Link kopierenLink in die Zwischenablage kopiert!
Hot plug a bridge network interface to a virtual machine (VM) while the VM is running.
Prerequisites
- A network attachment definition is configured in the same namespace as your VM.
-
You have installed the
virtctl
tool.
Procedure
If the VM to which you want to hot plug the network interface is not running, start it by using the following command:
virtctl start <vm_name> -n <namespace>
$ virtctl start <vm_name> -n <namespace>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following command to hot plug a new network interface to the running VM. The
virtctl addinterface
command adds the new network interface to the VM and virtual machine instance (VMI) specification but does not attach it to the running VM.virtctl addinterface <vm_name> --network-attachment-definition-name <net_attach_dev_namespace>/<net_attach_def_name> --name <interface_name>
$ virtctl addinterface <vm_name> --network-attachment-definition-name <net_attach_dev_namespace>/<net_attach_def_name> --name <interface_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow where:
- <vm_name>
-
The name of the
VirtualMachine
object. - <net_attach_def_name>
-
The name of the
NetworkAttachmentDefinition
object. - <net_attach_dev_namespace>
-
An identifier for the namespace associated with the
NetworkAttachmentDefinition
object. The supported values aredefault
or the name of the namespace where the VM is located. - <interface_name>
- The name of the new network interface.
To attach the network interface to the running VM, live migrate the VM by using the following command:
virtctl migrate <vm_name>
$ virtctl migrate <vm_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the VM live migration is successful by using the following command:
oc get VirtualMachineInstanceMigration -w
$ oc get VirtualMachineInstanceMigration -w
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that the new interface is added to the VM by checking the VMI status:
oc get vmi vm-fedora -ojsonpath="{ @.status.interfaces }"
$ oc get vmi vm-fedora -ojsonpath="{ @.status.interfaces }"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The hot plugged interface appears in the VMI status.
8.8.3. Hot unplugging a bridge network interface using the CLI Link kopierenLink in die Zwischenablage kopiert!
You can remove a bridge network interface from a running virtual machine (VM).
Prerequisites
- Your VM must be running.
- The VM must be created on a cluster running OpenShift Virtualization 4.14 or later.
- The VM must have a bridge network interface attached.
Procedure
Hot unplug a bridge network interface by running the following command. The
virtctl removeinterface
command detaches the network interface from the guest, but the interface still exists in the pod.virtctl removeinterface <vm_name> --name <interface_name>
$ virtctl removeinterface <vm_name> --name <interface_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Remove the interface from the pod by migrating the VM:
virtctl migrate <vm_name>
$ virtctl migrate <vm_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.9. Connecting a virtual machine to a service mesh Link kopierenLink in die Zwischenablage kopiert!
OpenShift Virtualization is now integrated with OpenShift Service Mesh. You can monitor, visualize, and control traffic between pods that run virtual machine workloads on the default pod network with IPv4.
8.9.1. Adding a virtual machine to a service mesh Link kopierenLink in die Zwischenablage kopiert!
To add a virtual machine (VM) workload to a service mesh, enable automatic sidecar injection in the VM configuration file by setting the sidecar.istio.io/inject
annotation to true
. Then expose your VM as a service to view your application in the mesh.
To avoid port conflicts, do not use ports used by the Istio sidecar proxy. These include ports 15000, 15001, 15006, 15008, 15020, 15021, and 15090.
Prerequisites
- You installed the Service Mesh Operators.
- You created the Service Mesh control plane.
- You added the VM project to the Service Mesh member roll.
Procedure
Edit the VM configuration file to add the
sidecar.istio.io/inject: "true"
annotation:Example configuration file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Apply the VM configuration:
oc apply -f <vm_name>.yaml
$ oc apply -f <vm_name>.yaml
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the virtual machine YAML file.
Create a
Service
object to expose your VM to the service mesh.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The service selector that determines the set of pods targeted by a service. This attribute corresponds to the
spec.metadata.labels
field in the VM configuration file. In the above example, theService
object namedvm-istio
targets TCP port 8080 on any pod with the labelapp=vm-istio
.
Create the service:
oc create -f <service_name>.yaml
$ oc create -f <service_name>.yaml
1 Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the service YAML file.
8.10. Configuring a dedicated network for live migration Link kopierenLink in die Zwischenablage kopiert!
You can configure a dedicated Multus network for live migration. A dedicated network minimizes the effects of network saturation on tenant workloads during live migration.
8.10.1. Configuring a dedicated secondary network for live migration Link kopierenLink in die Zwischenablage kopiert!
To configure a dedicated secondary network for live migration, you must first create a bridge network attachment definition (NAD) by using the CLI. Then, you add the name of the NetworkAttachmentDefinition
object to the HyperConverged
custom resource (CR).
Prerequisites
-
You installed the OpenShift CLI (
oc
). -
You logged in to the cluster as a user with the
cluster-admin
role. - Each node has at least two Network Interface Cards (NICs).
- The NICs for live migration are connected to the same VLAN.
Procedure
Create a
NetworkAttachmentDefinition
manifest according to the following example:Example configuration file
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the name of the
NetworkAttachmentDefinition
object. - 2 3
- Specify the name of the NIC to be used for live migration.
- 4
- Specify the name of the CNI plugin that provides the network for the NAD.
- 5
- Specify an IP address range for the secondary network. This range must not overlap the IP addresses of the main network.
Open the
HyperConverged
CR in your default editor by running the following command:oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the name of the
NetworkAttachmentDefinition
object to thespec.liveMigrationConfig
stanza of theHyperConverged
CR:Example
HyperConverged
manifestCopy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the name of the Multus
NetworkAttachmentDefinition
object to be used for live migrations.
-
Save your changes and exit the editor. The
virt-handler
pods restart and connect to the secondary network.
Verification
When the node that the virtual machine runs on is placed into maintenance mode, the VM automatically migrates to another node in the cluster. You can verify that the migration occurred over the secondary network and not the default pod network by checking the target IP address in the virtual machine instance (VMI) metadata.
oc get vmi <vmi_name> -o jsonpath='{.status.migrationState.targetNodeAddress}'
$ oc get vmi <vmi_name> -o jsonpath='{.status.migrationState.targetNodeAddress}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.10.2. Selecting a dedicated network by using the web console Link kopierenLink in die Zwischenablage kopiert!
You can select a dedicated network for live migration by using the OpenShift Container Platform web console.
Prerequisites
- You configured a Multus network for live migration.
- You created a network attachment definition for the network.
Procedure
- Navigate to Virtualization > Overview in the OpenShift Container Platform web console.
- Click the Settings tab and then click Live migration.
- Select the network from the Live migration network list.
8.11. Configuring and viewing IP addresses Link kopierenLink in die Zwischenablage kopiert!
You can configure an IP address when you create a virtual machine (VM). The IP address is provisioned with cloud-init.
You can view the IP address of a VM by using the OpenShift Container Platform web console or the command line. The network information is collected by the QEMU guest agent.
8.11.1. Configuring IP addresses for virtual machines Link kopierenLink in die Zwischenablage kopiert!
You can configure a static IP address when you create a virtual machine (VM) by using the web console or the command line.
You can configure a dynamic IP address when you create a VM by using the command line.
The IP address is provisioned with cloud-init.
8.11.1.1. Configuring an IP address when creating a virtual machine by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can configure a static or dynamic IP address when you create a virtual machine (VM). The IP address is provisioned with cloud-init.
If the VM is connected to the pod network, the pod network interface is the default route unless you update it.
Prerequisites
- The virtual machine is connected to a secondary network.
- You have a DHCP server available on the secondary network to configure a dynamic IP for the virtual machine.
Procedure
Edit the
spec.template.spec.volumes.cloudInitNoCloud.networkData
stanza of the virtual machine configuration:To configure a dynamic IP address, specify the interface name and enable DHCP:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the interface name.
To configure a static IP, specify the interface name and the IP address:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.11.2. Viewing IP addresses of virtual machines Link kopierenLink in die Zwischenablage kopiert!
You can view the IP address of a VM by using the OpenShift Container Platform web console or the command line.
The network information is collected by the QEMU guest agent.
8.11.2.1. Viewing the IP address of a virtual machine by using the web console Link kopierenLink in die Zwischenablage kopiert!
You can view the IP address of a virtual machine (VM) by using the OpenShift Container Platform web console.
You must install the QEMU guest agent on a VM to view the IP address of a secondary network interface. A pod network interface does not require the QEMU guest agent.
Procedure
-
In the OpenShift Container Platform console, click Virtualization
VirtualMachines from the side menu. - Select a VM to open the VirtualMachine details page.
- Click the Details tab to view the IP address.
8.11.2.2. Viewing the IP address of a virtual machine by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can view the IP address of a virtual machine (VM) by using the command line.
You must install the QEMU guest agent on a VM to view the IP address of a secondary network interface. A pod network interface does not require the QEMU guest agent.
Procedure
Obtain the virtual machine instance configuration by running the following command:
oc describe vmi <vmi_name>
$ oc describe vmi <vmi_name>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.12. Accessing a virtual machine by using the cluster FQDN Link kopierenLink in die Zwischenablage kopiert!
You can access a virtual machine (VM) that is attached to a secondary network interface from outside the cluster by using the fully qualified domain name (FQDN) of the cluster.
Accessing VMs by using the cluster FQDN is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see Technology Preview Features Support Scope.
8.12.1. Configuring a DNS server for secondary networks Link kopierenLink in die Zwischenablage kopiert!
The Cluster Network Addons Operator (CNAO) deploys a Domain Name Server (DNS) server and monitoring components when you enable the deployKubeSecondaryDNS
feature gate in the HyperConverged
custom resource (CR).
Prerequisites
-
You installed the OpenShift CLI (
oc
). - You configured a load balancer for the cluster.
-
You logged in to the cluster with
cluster-admin
permissions.
Procedure
Create a load balancer service to expose the DNS server outside the cluster by running the
oc expose
command according to the following example:oc expose -n openshift-cnv deployment/secondary-dns --name=dns-lb \ --type=LoadBalancer --port=53 --target-port=5353 --protocol='UDP'
$ oc expose -n openshift-cnv deployment/secondary-dns --name=dns-lb \ --type=LoadBalancer --port=53 --target-port=5353 --protocol='UDP'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Retrieve the external IP address by running the following command:
oc get service -n openshift-cnv
$ oc get service -n openshift-cnv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dns-lb LoadBalancer 172.30.27.5 10.46.41.94 53:31829/TCP 5s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE dns-lb LoadBalancer 172.30.27.5 10.46.41.94 53:31829/TCP 5s
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Edit the
HyperConverged
CR in your default editor by running the following command:oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
$ oc edit hyperconverged kubevirt-hyperconverged -n openshift-cnv
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the DNS server and monitoring components according to the following example:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Specify the external IP address exposed by the load balancer service.
- Save the file and exit the editor.
Retrieve the cluster FQDN by running the following command:
oc get dnses.config.openshift.io cluster -o jsonpath='{.spec.baseDomain}'
$ oc get dnses.config.openshift.io cluster -o jsonpath='{.spec.baseDomain}'
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
openshift.example.com
openshift.example.com
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Point to the DNS server by using one of the following methods:
Add the
kubeSecondaryDNSNameServerIP
value to theresolv.conf
file on your local machine.NoteEditing the
resolv.conf
file overwrites existing DNS settings.Add the
kubeSecondaryDNSNameServerIP
value and the cluster FQDN to the enterprise DNS server records. For example:vm.<FQDN>. IN NS ns.vm.<FQDN>.
vm.<FQDN>. IN NS ns.vm.<FQDN>.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ns.vm.<FQDN>. IN A 10.46.41.94
ns.vm.<FQDN>. IN A 10.46.41.94
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.12.2. Connecting to a VM on a secondary network by using the cluster FQDN Link kopierenLink in die Zwischenablage kopiert!
You can access a running virtual machine (VM) attached to a secondary network interface by using the fully qualified domain name (FQDN) of the cluster.
Prerequisites
- You installed the QEMU guest agent on the VM.
- The IP address of the VM is public.
- You configured the DNS server for secondary networks.
- You retrieved the fully qualified domain name (FQDN) of the cluster.
Procedure
Retrieve the network interface name from the VM configuration by running the following command:
oc get vm -n <namespace> <vm_name> -o yaml
$ oc get vm -n <namespace> <vm_name> -o yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- Note the name of the network interface.
Connect to the VM by using the
ssh
command:ssh <user_name>@<interface_name>.<vm_name>.<namespace>.vm.<cluster_fqdn>
$ ssh <user_name>@<interface_name>.<vm_name>.<namespace>.vm.<cluster_fqdn>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
8.13. Managing MAC address pools for network interfaces Link kopierenLink in die Zwischenablage kopiert!
The KubeMacPool component allocates MAC addresses for virtual machine (VM) network interfaces from a shared MAC address pool. This ensures that each network interface is assigned a unique MAC address.
A virtual machine instance created from that VM retains the assigned MAC address across reboots.
KubeMacPool does not handle virtual machine instances created independently from a virtual machine.
8.13.1. Managing KubeMacPool by using the command line Link kopierenLink in die Zwischenablage kopiert!
You can disable and re-enable KubeMacPool by using the command line.
KubeMacPool is enabled by default.
Procedure
To disable KubeMacPool in two namespaces, run the following command:
oc label namespace <namespace1> <namespace2> mutatevirtualmachines.kubemacpool.io=ignore
$ oc label namespace <namespace1> <namespace2> mutatevirtualmachines.kubemacpool.io=ignore
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To re-enable KubeMacPool in two namespaces, run the following command:
oc label namespace <namespace1> <namespace2> mutatevirtualmachines.kubemacpool.io-
$ oc label namespace <namespace1> <namespace2> mutatevirtualmachines.kubemacpool.io-
Copy to Clipboard Copied! Toggle word wrap Toggle overflow