daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Nov 21st, 2018 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. MASTER_HOST=$1
  3. ETCD_HOST=$2
  4. USER=root
  5. my_KUBE_CIDR="10.244.0.0/16"
  6. # check and ensure that args were given
  7. if [ ! $# -eq 2 ]; then
  8.   # Print usage
  9.   echo 'Error! wrong number of arguments, this script expects two hosts'
  10.   echo 'usage:'
  11.   echo "$0 host1 host2"
  12.   exit 1
  13. fi
  14.  
  15.  
  16. command2run="cat << EOF > etcd-pki-files.txt
  17. /etc/kubernetes/pki/etcd/ca.crt
  18. /etc/kubernetes/pki/apiserver-etcd-client.crt
  19. /etc/kubernetes/pki/apiserver-etcd-client.key
  20. /etc/kubernetes/kubeadmcfg-external.yaml
  21. EOF"
  22. ssh ${USER}@${ETCD_HOST} "$command2run"
  23.  
  24. # create the archive
  25. command2run="tar -czf etcd-pki.tar.gz -T etcd-pki-files.txt"
  26. ssh ${USER}@${ETCD_HOST} "$command2run"
  27. command2run="tar -czf - -T etcd-pki-files.txt"
  28. ssh ${USER}@${ETCD_HOST} "$command2run" | ssh ${USER}@${MASTER_HOST} "cd /; tar zxvf -"
  29. #command2run="cd /; tar zcf - /etc/kubernetes/kubeadmcfg-external.yaml"
  30. #ssh ${USER}@${ETCD_HOST} "$command2run" | ssh ${USER}@${MASTER_HOST} "cd /; tar zxvf -"
  31.  
  32. command2run="sed -i 's/REPLACE_ME/$MASTER_HOST/g' /etc/kubernetes/kubeadmcfg-external.yaml"
  33. ssh ${USER}@${MASTER_HOST} "$command2run"
  34. command2run="kubeadm init  --ignore-preflight-errors=FileAvailable--etc-kubernetes-manifests-etcd.yaml,ExternalEtcdVersion --config /etc/kubernetes/kubeadmcfg-external.yaml"
  35. echo "$command2run"
  36. ssh ${USER}@${MASTER_HOST} "$command2run"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top