Multiple fixes to deployment scripts and lab
- Clean up private/pub keys from k8s nodes - Install kpm on k8s nodes, not on master node
This commit is contained in:
parent
bc29db7bd2
commit
0e48ce51ce
3 changed files with 18 additions and 14 deletions
18
Vagrantfile
vendored
18
Vagrantfile
vendored
|
@ -37,10 +37,8 @@ Vagrant.configure("2") do |config|
|
||||||
(1..$num_instances).each do |i|
|
(1..$num_instances).each do |i|
|
||||||
# First node would be master node
|
# First node would be master node
|
||||||
if i == 1
|
if i == 1
|
||||||
bootstrap_script = "bootstrap-master.sh"
|
|
||||||
master = true
|
master = true
|
||||||
else
|
else
|
||||||
bootstrap_script = "bootstrap-node.sh"
|
|
||||||
master = false
|
master = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -74,14 +72,16 @@ Vagrant.configure("2") do |config|
|
||||||
test_vm.vm.network :private_network, :ip => "#{ip}"
|
test_vm.vm.network :private_network, :ip => "#{ip}"
|
||||||
|
|
||||||
# Provisioning
|
# 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 "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
|
||||||
end
|
end
|
||||||
|
|
|
@ -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 git clone https://github.com/kubespray/kargo-cli.git /root/kargo-cli
|
||||||
sudo sh -c 'cd /root/kargo-cli && python setup.py install'
|
sudo sh -c 'cd /root/kargo-cli && python setup.py install'
|
||||||
|
|
||||||
# Pip
|
# k8s deploy script and configs
|
||||||
sudo pip install kpm
|
|
||||||
|
|
||||||
# k8s deploy script and config
|
|
||||||
sudo sh -c 'cp -a ~vagrant/deploy-k8s.kargo.sh /root/ && chmod 755 /root/deploy-k8s.kargo.sh'
|
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/custom.yaml /root/custom.yaml
|
||||||
|
sudo cp -a ~vagrant/kubedns.yaml /root/kubedns.yaml
|
||||||
|
|
||||||
# SSH keys and config
|
# SSH keys and config
|
||||||
sudo rm -rf /root/.ssh
|
sudo rm -rf /root/.ssh
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo node > /var/tmp/role
|
echo node > /var/tmp/role
|
||||||
|
|
||||||
|
# Packages
|
||||||
sudo apt-get --yes update
|
sudo apt-get --yes update
|
||||||
sudo apt-get --yes upgrade
|
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 rm -rf /root/.ssh
|
||||||
sudo mv ~vagrant/ssh /root/.ssh
|
sudo mv ~vagrant/ssh /root/.ssh
|
||||||
|
sudo rm -f /root/.ssh/id_rsa*
|
||||||
sudo chown -R root: /root/.ssh
|
sudo chown -R root: /root/.ssh
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue