Fixes and improvements
- Move kubedns to a separate mini playbook - Fix custom.yaml location
This commit is contained in:
parent
8d8622bbb9
commit
bc29db7bd2
4 changed files with 13 additions and 6 deletions
|
@ -18,8 +18,7 @@ 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 git clone https://github.com/kubespray/kargo /root/kargo
|
||||
sudo cp -a ~vagrant/custom.yaml /root/kargo/custom.yaml
|
||||
sudo cp -a ~vagrant/custom.yaml /root/custom.yaml
|
||||
|
||||
# SSH keys and config
|
||||
sudo rm -rf /root/.ssh
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
kube_network_plugin: "calico"
|
||||
kube_proxy_mode: "iptables"
|
||||
local_release_dir: "/var/tmp/releases"
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
INVENTORY="kargo/inventory/inventory.cfg"
|
||||
|
||||
nodes=""
|
||||
i=1
|
||||
for nodeip in `cat /root/nodes` ; do
|
||||
|
@ -7,18 +9,18 @@ for nodeip in `cat /root/nodes` ; do
|
|||
nodes+=" node${i}[ansible_ssh_host=${nodeip},ip=${nodeip}]"
|
||||
done
|
||||
|
||||
if [ -f kargo/inventory/inventory.cfg ] ; then
|
||||
echo "kargo/inventory/inventory.cfg already exists, if you want to recreate, pls remove it and re-run this script"
|
||||
if [ -f "$INVENTORY" ] ; then
|
||||
echo "$INVENTORY already exists, if you want to recreate, pls remove it and re-run this script"
|
||||
else
|
||||
echo "Preparing inventory..."
|
||||
kargo prepare -y --nodes $nodes
|
||||
fi
|
||||
|
||||
echo "Running deployment..."
|
||||
kargo deploy -y --ansible-opts="-e @kargo/custom.yaml"
|
||||
kargo deploy -y --ansible-opts="-e @custom.yaml"
|
||||
deploy_res=$?
|
||||
|
||||
if [ "$deploy_res" -eq "0" ]; then
|
||||
echo "Setting up kubedns..."
|
||||
kpm deploy kube-system/kubedns --namespace=kube-system
|
||||
ansible-playbook -i $INVENTORY kubedns.yaml
|
||||
fi
|
||||
|
|
5
kubedns.yaml
Normal file
5
kubedns.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
- hosts: kube-master
|
||||
tasks:
|
||||
- name: setup-kubedns
|
||||
shell: kpm deploy kube-system/kubedns --namespace=kube-system
|
||||
run_once: true
|
Loading…
Reference in a new issue