From 0e48ce51cef8bc420d1037f3a8d04e1437df1561 Mon Sep 17 00:00:00 2001 From: Aleksandr Didenko Date: Mon, 20 Jun 2016 12:02:25 +0200 Subject: [PATCH] Multiple fixes to deployment scripts and lab - Clean up private/pub keys from k8s nodes - Install kpm on k8s nodes, not on master node --- Vagrantfile | 18 +++++++++--------- bootstrap-master.sh | 6 ++---- bootstrap-node.sh | 8 +++++++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 39a316514..8960345ec 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -37,10 +37,8 @@ Vagrant.configure("2") do |config| (1..$num_instances).each do |i| # First node would be master node if i == 1 - bootstrap_script = "bootstrap-master.sh" master = true else - bootstrap_script = "bootstrap-node.sh" master = false end @@ -74,14 +72,16 @@ Vagrant.configure("2") do |config| test_vm.vm.network :private_network, :ip => "#{ip}" # Provisioning - if master - config.vm.provision "file", source: "deploy-k8s.kargo.sh", destination: "~/deploy-k8s.kargo.sh" - config.vm.provision "file", source: "custom.yaml", destination: "~/custom.yaml" - config.vm.provision "file", source: "nodes", destination: "~/nodes" - end - config.vm.provision "file", source: "ssh", destination: "~/ssh" - config.vm.provision :shell, :path => bootstrap_script + if master + config.vm.provision "deploy-k8s", type: "file", source: "deploy-k8s.kargo.sh", destination: "~/deploy-k8s.kargo.sh" + config.vm.provision "custom.yaml", type: "file", source: "custom.yaml", destination: "~/custom.yaml" + config.vm.provision "kubedns.yaml", type: "file", source: "kubedns.yaml", destination: "~/kubedns.yaml" + config.vm.provision "nodes", type: "file", source: "nodes", destination: "~/nodes" + config.vm.provision "bootstrap", type: "shell", path: "bootstrap-master.sh" + else + config.vm.provision "bootstrap", type: "shell", path: "bootstrap-node.sh" + end end end diff --git a/bootstrap-master.sh b/bootstrap-master.sh index 1163ce8ad..ff7e48342 100755 --- a/bootstrap-master.sh +++ b/bootstrap-master.sh @@ -13,12 +13,10 @@ sudo sh -c 'apt-add-repository -y ppa:ansible/ansible;apt-get update;apt-get ins sudo git clone https://github.com/kubespray/kargo-cli.git /root/kargo-cli sudo sh -c 'cd /root/kargo-cli && python setup.py install' -# Pip -sudo pip install kpm - -# k8s deploy script and config +# k8s deploy script and configs sudo sh -c 'cp -a ~vagrant/deploy-k8s.kargo.sh /root/ && chmod 755 /root/deploy-k8s.kargo.sh' sudo cp -a ~vagrant/custom.yaml /root/custom.yaml +sudo cp -a ~vagrant/kubedns.yaml /root/kubedns.yaml # SSH keys and config sudo rm -rf /root/.ssh diff --git a/bootstrap-node.sh b/bootstrap-node.sh index dcc81727a..a38e10b25 100755 --- a/bootstrap-node.sh +++ b/bootstrap-node.sh @@ -1,11 +1,17 @@ #!/bin/bash echo node > /var/tmp/role +# Packages sudo apt-get --yes update sudo apt-get --yes upgrade -sudo apt-get --yes install screen vim telnet tcpdump +sudo apt-get --yes install screen vim telnet tcpdump python-pip +# Pip +sudo pip install kpm + +# SSH sudo rm -rf /root/.ssh sudo mv ~vagrant/ssh /root/.ssh +sudo rm -f /root/.ssh/id_rsa* sudo chown -R root: /root/.ssh