diff options
author | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-16 12:23:16 -0500 |
---|---|---|
committer | Guo Ruijing <ruijing.guo@intel.com> | 2017-11-20 18:43:47 -0500 |
commit | 57c01199d342c5051fef2bb94f463f21749089bb (patch) | |
tree | c2e6c28b3bd1fed53b92038bf1286e82f4661606 /src/vagrant/kubeadm_ovsdpdk | |
parent | b2da960212571fc3e287eedcdc4c8c92fed9bf83 (diff) |
add examples for container4nfv
1. add example for kubeadm with weave
2. add example for kubeadm with multus
3. add example for kubeadm with ovsdpdk
4. add example for kubeadm with virtlet
Change-Id: I138e71e45f0aba8389dca0e1a826f4662572af29
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Diffstat (limited to 'src/vagrant/kubeadm_ovsdpdk')
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/Vagrantfile | 2 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_ovsdpdk/deploy.sh | 3 | ||||
-rwxr-xr-x | src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh | 39 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/master_setup.sh | 2 | ||||
-rw-r--r-- | src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh | 6 |
5 files changed, 48 insertions, 4 deletions
diff --git a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile index b4f3b0f..2d69109 100644 --- a/src/vagrant/kubeadm_ovsdpdk/Vagrantfile +++ b/src/vagrant/kubeadm_ovsdpdk/Vagrantfile @@ -20,6 +20,7 @@ Vagrant.configure("2") do |config| config.vm.hostname = "master" config.vm.provision "shell", path: "master_setup.sh", privileged: false config.vm.network :private_network, ip: "192.168.1.10" + config.vm.network :private_network, ip: "10.244.0.10" end (1 .. $num_workers).each do |i| @@ -27,6 +28,7 @@ Vagrant.configure("2") do |config| config.vm.hostname = vm_name config.vm.provision "shell", path: "worker_setup.sh", privileged: false config.vm.network :private_network, ip: "192.168.1.#{i+20}" + config.vm.network :private_network, ip: "10.244.0.#{i+20}" end end diff --git a/src/vagrant/kubeadm_ovsdpdk/deploy.sh b/src/vagrant/kubeadm_ovsdpdk/deploy.sh index f5b810e..2cf96b9 100755 --- a/src/vagrant/kubeadm_ovsdpdk/deploy.sh +++ b/src/vagrant/kubeadm_ovsdpdk/deploy.sh @@ -4,5 +4,8 @@ set -ex DIR="$(dirname `readlink -f $0`)" cd $DIR +vagrant destroy -f +rm -rf container-ipam-state vagrant up +vagrant ssh master -c "/vagrant/examples/virtio-user.sh" || (vagrant destroy -f; exit 1) vagrant destroy -f diff --git a/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh new file mode 100755 index 0000000..dd918de --- /dev/null +++ b/src/vagrant/kubeadm_ovsdpdk/examples/virtio-user.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# +# Copyright (c) 2017 Intel Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +set -ex + +kubectl delete rc --all +kubectl apply -f /vagrant/examples/virtio-user.yaml +r="0" +while [ $r -ne "4" ] +do + r=$(kubectl get pods --all-namespaces | grep ovsdpdk | grep Run | wc -l) + sleep 20 +done + +kubectl delete rc --all +kubectl apply -f /vagrant/examples/virtio-user.yaml +r="0" +while [ $r -ne "2" ] +do + r=$(kubectl get pods | grep Running | wc -l) + sleep 20 +done +kubectl get pods --all-namespaces +sleep 20 +ping -c4 10.244.0.103 || ping -c4 10.244.0.104 diff --git a/src/vagrant/kubeadm_ovsdpdk/master_setup.sh b/src/vagrant/kubeadm_ovsdpdk/master_setup.sh index 28a4c4a..b9cd5db 100644 --- a/src/vagrant/kubeadm_ovsdpdk/master_setup.sh +++ b/src/vagrant/kubeadm_ovsdpdk/master_setup.sh @@ -2,7 +2,7 @@ set -ex -sudo timeout 600 kubeadm init --apiserver-advertise-address=192.168.1.10 --service-cidr=192.168.1.0/24 --pod-network-cidr=10.244.0.0/16 --token 8c5adc.1cec8dbf339093f0 +sudo timeout 600 kubeadm init --apiserver-advertise-address=192.168.1.10 --service-cidr=192.168.1.0/24 --pod-network-cidr=10.244.0.0/24 --token 8c5adc.1cec8dbf339093f0 sudo cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf diff --git a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh index fed7985..4fc3d17 100644 --- a/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh +++ b/src/vagrant/kubeadm_ovsdpdk/ovsdpdk/start.sh @@ -7,9 +7,9 @@ do sudo sysctl -w vm.nr_hugepages=2048; sleep 1 done sudo modprobe uio_pci_generic -ip=$(ip a s enp0s9 | grep inet | grep -v inet6 | sed "s/.*inet//" | cut -f2 -d' ') -sudo ip address flush enp0s9 -sudo /usr/share/dpdk/tools/dpdk_nic_bind.py --bind=uio_pci_generic enp0s9 +ip=$(ip a s eth2 | grep inet | grep -v inet6 | sed "s/.*inet//" | cut -f2 -d' ') +sudo ip address flush eth2 +sudo /usr/share/dpdk/tools/dpdk_nic_bind.py --bind=uio_pci_generic eth2 sudo sysctl -w vm.nr_hugepages=1024 sudo mount -t hugetlbfs -o pagesize=2M none /dev/hugepages sudo cp /usr/bin/ovs-vsctl /usr/local/bin |