Skip to content

Configuring Network

By default, the NodePools for the KubeVirt platform generate VMs which are attached to the default pod network. It is possible to attach additional networks to the NodePools VMs as well though.

Attaching Additional Networks to KubeVirt VMs

Attaching additional networks to a KubeVirt NodePool is accomplished through the usage of multus and NetworkAttachmentDefinitions. More information about how to configure NetworkAttachementDefinitions can be found here. Below is an example of adding multiple additional networks to a guest cluster at creation time using the hcp command line tool with the --additional-network argument.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
export CLUSTER_NAME=example
export PULL_SECRET="$HOME/pull-secret"
export MEM="6Gi"
export CPU="2"
export WORKER_COUNT="2"

hcp create cluster kubevirt \
--name $CLUSTER_NAME \
--node-pool-replicas $WORKER_COUNT \
--pull-secret $PULL_SECRET \
--memory $MEM \
--cores $CPU \
–additional-network name:my-namespace/network1 \
–additional-network name:my-namespace/network2

In this example, the KubeVirt VMs will have interfaces attached to the networks for the NetworkAttachmentDefinitions network1 and network2 which reside in namespace my-namespace.