summaryrefslogtreecommitdiffstats
path: root/src/vagrant/k8s_kubeadm/ovsdpdk
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2017-08-03 08:42:12 -0700
committerGuo Ruijing <ruijing.guo@intel.com>2017-08-03 08:43:45 -0700
commit79c38bff1b279a6d73bbbffd98f44613d76afbfe (patch)
tree5a0431ebf2f401e0fe8ae9eaffc8d540175814b8 /src/vagrant/k8s_kubeadm/ovsdpdk
parentdc766e69c0c08c55b6df2384bbcfd1e712f03160 (diff)
deploy ovsdpdk by k8s
Change-Id: Ie8ea880db410e699cdda147b304705819e13157a Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/vagrant/k8s_kubeadm/ovsdpdk')
-rw-r--r--src/vagrant/k8s_kubeadm/ovsdpdk/Dockerfile8
-rw-r--r--src/vagrant/k8s_kubeadm/ovsdpdk/install.sh7
-rw-r--r--src/vagrant/k8s_kubeadm/ovsdpdk/kube_ovsdpdk.yml53
-rw-r--r--src/vagrant/k8s_kubeadm/ovsdpdk/start.sh15
4 files changed, 83 insertions, 0 deletions
diff --git a/src/vagrant/k8s_kubeadm/ovsdpdk/Dockerfile b/src/vagrant/k8s_kubeadm/ovsdpdk/Dockerfile
new file mode 100644
index 0000000..a63df8f
--- /dev/null
+++ b/src/vagrant/k8s_kubeadm/ovsdpdk/Dockerfile
@@ -0,0 +1,8 @@
+FROM ubuntu:16.04
+
+WORKDIR /ovsdpdk
+RUN apt-get update && apt-get install -y sudo
+ADD install.sh .
+RUN bash ./install.sh
+ADD start.sh .
+RUN chmod 755 start.sh
diff --git a/src/vagrant/k8s_kubeadm/ovsdpdk/install.sh b/src/vagrant/k8s_kubeadm/ovsdpdk/install.sh
new file mode 100644
index 0000000..66fb71d
--- /dev/null
+++ b/src/vagrant/k8s_kubeadm/ovsdpdk/install.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -ex
+sudo apt-get update
+sudo apt-get install -y openvswitch-switch-dpdk linux-image-extra-4.4.0-75-generic
+sudo update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
+echo "DPDK_OPTS='--dpdk -c 0x1 -n 4 -m 1024'" | sudo tee -a /etc/default/openvswitch-switch
diff --git a/src/vagrant/k8s_kubeadm/ovsdpdk/kube_ovsdpdk.yml b/src/vagrant/k8s_kubeadm/ovsdpdk/kube_ovsdpdk.yml
new file mode 100644
index 0000000..d79da15
--- /dev/null
+++ b/src/vagrant/k8s_kubeadm/ovsdpdk/kube_ovsdpdk.yml
@@ -0,0 +1,53 @@
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: ovsdpdk
+ namespace: kube-system
+---
+apiVersion: extensions/v1beta1
+kind: DaemonSet
+metadata:
+ name: kube-ovsdpdk-ds
+ namespace: kube-system
+ labels:
+ tier: node
+ app: ovsdpdk
+spec:
+ template:
+ metadata:
+ labels:
+ tier: node
+ app: ovsdpdk
+ spec:
+ hostNetwork: true
+ nodeSelector:
+ beta.kubernetes.io/arch: amd64
+ tolerations:
+ - key: node-role.kubernetes.io/master
+ operator: Exists
+ effect: NoSchedule
+ serviceAccountName: ovsdpdk
+ containers:
+ - name: install-ovsdpdk
+ image: openretriever/ubuntu1604-ovsdpdk
+ command: [ "/bin/bash", "/ovsdpdk/start.sh" ]
+ securityContext:
+ privileged: true
+ volumeMounts:
+ - name: local-bin
+ mountPath: /usr/local/bin
+ - name: var-run
+ mountPath: /var/run/openvswitch
+ - name: dev-hugepage
+ mountPath: /dev
+ volumes:
+ - name: local-bin
+ hostPath:
+ path: /usr/local/bin
+ - name: var-run
+ hostPath:
+ path: /var/run/openvswitch
+ - name: dev-hugepage
+ hostPath:
+ path: /dev
diff --git a/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh b/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh
new file mode 100644
index 0000000..08d8143
--- /dev/null
+++ b/src/vagrant/k8s_kubeadm/ovsdpdk/start.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+set -ex
+sudo sysctl -w vm.nr_hugepages=2048
+sudo mount -t hugetlbfs -o pagesize=2M none /dev/hugepages
+cp /usr/bin/ovs-vsctl /usr/local/bin
+sudo service dpdk restart
+sudo service openvswitch-switch restart
+sudo ovs-vsctl add-br br-dpdk -- set bridge br-dpdk datapath_type=netdev
+sudo modprobe uio_pci_generic
+#sudo ip address flush enp0s9
+#sudo /usr/share/dpdk/tools/dpdk_nic_bind.py --bind=uio_pci_generic enp0s9
+#sudo ovs-vsctl add-port br-dpdk dpdk0 -- set Interface dpdk0 type=dpdk
+while true; do sleep 3600; done
+echo sudo docker run -ti --privileged -v /dev:/dev -v /usr/local/bin:/usr/local/bin -v /var/run/openvswitch/:/var/run/openvswitch/ dpdk /ovsdpdk/start.sh