Skip to content

Instantly share code, notes, and snippets.

dnf -y install git
dnf -y install rsync
dnf -y install make
dnf -y install docker
systemctl start docker
systemctl enable docker
git clone https://github.com/kubevirt/kubevirt.git
# you may need to run this before the build: iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# where eth0 should be replaced with whatever is on that machine
# do that if the containers fail to fetch the software they need when running "make"
yum -y install git
yum -y install rsync
yum -y install make
yum -y install docker
systemctl start docker
systemctl enable docker
git clone https://github.com/kubevirt/kubevirt.git

This is based on this blog post

Initial Stage

Create two namespaces:

sudo ip netns add ns1
sudo ip netns add ns2

Use a veth Pair

Create veth pair and set each side in each namespace:

@yuvalif
yuvalif / test_mt_setns.cpp
Created August 28, 2018 10:48
forcing race condition on setns() in multi-threaded environment
// This file tries to create net namespace race condition
// in order to verify thread safety of setting a thread to a network namespace.
//
// To compile: g++ -Wall -O2 -o test_ns test_ns.cpp -lpthread
//
// before running, call the following bash command to create network namespaces 0-9:
// for i in {0..9}
// do
// ip netns add ns$i
// done

Setup

Start k8s suitable for flannel CNI:

kubeadm init --pod-network-cidr=10.244.0.0/16

Copy kubeconfig:

mkdir -p /$USER/.kube && cp /etc/kubernetes/admin.conf /$USER/.kube/config

Check that bridge-nf-call-iptables equals 1:

@yuvalif
yuvalif / build-libvirt-fedora28.md
Last active October 2, 2018 13:12
Building libvirt on Fedora28

Fllow instructions from here. Some missing dependencies after running ./autogen.sh. Note that in consequent runs ./configure is sufficient.

 sudo dnf install -y rpcgen
 sudo dnf install -y gnutls-devel
 sudo dnf install -y libnl3-devel
 sudo dnf install -y libxml2-devel
 sudo dnf install -y libtirpc-devel
 sudo dnf install -y yajl-devel
apiVersion: kubevirt.io/v1alpha2
kind: VirtualMachineInstance
metadata:
creationTimestamp: null
labels:
special: vmi-pxe-boot
name: vmi-pxe-boot
spec:
domain:
devices:
apiVersion: v1
kind: Pod
metadata:
name: cirros
spec:
containers:
- name: cirros
image: cirros
resources:
limits:
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: cirros
spec:
template:
metadata:
labels:
app: cirros-sleep
spec: