Skip to content

Instantly share code, notes, and snippets.

@yuvalif
Last active August 8, 2018 13:52
Show Gist options
  • Save yuvalif/2aa4eaa31e37cb24bb3ae6ed12081314 to your computer and use it in GitHub Desktop.
Save yuvalif/2aa4eaa31e37cb24bb3ae6ed12081314 to your computer and use it in GitHub Desktop.

Create bridge on node:

# this step is needed so that the bridge would forward traffic
sudo echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sudo sysctl -p

# create the bridge
sudo ip link add red type bridge
sudo ip link set dev red up

# connect the bridge to an interface where to which the PXE server is also connected
# note that this interface should not have an IP address or configured to use DHCP
sudo ip link set eth1 master red
ip link show red

Create device plugin with its configuration:

kubectl create configmap device-plugin-network-bridge --from-literal=bridges="red"
kubectl create -f https://raw.githubusercontent.com/kubevirt/kubernetes-device-plugins/master/manifests/bridge-ds.yml

Create a yaml with the VMI configuration. Note that it has 2 interface, the default one from the pod and another L2 one from the device plugin: https://gist.github.com/yuvalif/32ef18bd8cff2961d138b149983a1b9a

Create a VM connected to the "red" bridge:

wget https://gist.githubusercontent.com/yuvalif/32ef18bd8cff2961d138b149983a1b9a/raw/b083cd2b638b06c956a880789da6c04a2659ad94/vmi-bridge.yaml

kubectl create -f vmi-bridge.yaml

Wait for the launcher pod to start and use vnc to get the PXE boot screen:

virtctl vnc vmi-bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment