From 57c01199d342c5051fef2bb94f463f21749089bb Mon Sep 17 00:00:00 2001 From: Guo Ruijing Date: Thu, 16 Nov 2017 12:23:16 -0500 Subject: 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 --- src/vagrant/kubeadm_basic/deploy.sh | 1 + src/vagrant/kubeadm_basic/examples/nginx-app.sh | 12 +++++++++++- src/vagrant/kubeadm_basic/examples/nginx-app.yaml | 2 +- src/vagrant/kubeadm_basic/master_setup.sh | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/vagrant/kubeadm_basic') diff --git a/src/vagrant/kubeadm_basic/deploy.sh b/src/vagrant/kubeadm_basic/deploy.sh index f5b810e..4e12e91 100755 --- a/src/vagrant/kubeadm_basic/deploy.sh +++ b/src/vagrant/kubeadm_basic/deploy.sh @@ -5,4 +5,5 @@ DIR="$(dirname `readlink -f $0`)" cd $DIR vagrant up +vagrant ssh master -c "/vagrant/examples/nginx-app.sh" || (vagrant destroy -f; exit 1) vagrant destroy -f diff --git a/src/vagrant/kubeadm_basic/examples/nginx-app.sh b/src/vagrant/kubeadm_basic/examples/nginx-app.sh index bfd0613..07b9c22 100755 --- a/src/vagrant/kubeadm_basic/examples/nginx-app.sh +++ b/src/vagrant/kubeadm_basic/examples/nginx-app.sh @@ -5,6 +5,16 @@ kubectl get nodes kubectl get services kubectl get pods kubectl get rc -sleep 120 + +r="0" +while [ $r -ne "2" ] +do + r=$(kubectl get pods | grep Running | wc -l) + sleep 20 +done + svcip=$(kubectl get services nginx -o json | grep clusterIP | cut -f4 -d'"') wget http://$svcip +kubectl delete rc --all +kubectl delete services --all +kubectl delete pod --all diff --git a/src/vagrant/kubeadm_basic/examples/nginx-app.yaml b/src/vagrant/kubeadm_basic/examples/nginx-app.yaml index f80881a..7bb5e9b 100644 --- a/src/vagrant/kubeadm_basic/examples/nginx-app.yaml +++ b/src/vagrant/kubeadm_basic/examples/nginx-app.yaml @@ -26,6 +26,6 @@ spec: spec: containers: - name: nginx - image: nginx + image: nginx:1.13.6 ports: - containerPort: 80 diff --git a/src/vagrant/kubeadm_basic/master_setup.sh b/src/vagrant/kubeadm_basic/master_setup.sh index 0e33177..1d204c2 100644 --- a/src/vagrant/kubeadm_basic/master_setup.sh +++ b/src/vagrant/kubeadm_basic/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=10.96.0.0/16 --pod-network-cidr=10.32.0.0/12 --token 8c5adc.1cec8dbf339093f0 sudo cp /etc/kubernetes/admin.conf $HOME/ sudo chown $(id -u):$(id -g) $HOME/admin.conf export KUBECONFIG=$HOME/admin.conf -- cgit 1.2.3-korg