#!/bin/bash
cd /etc/kubernetes/
for NODE in k8s-node01 k8s-node02 k8s-node03; do
   sshpass ssh -p 22 root@$NODE 'mkdir -p /etc/kubernetes/pki /etc/etcd/ssl'
   for FILE in etcd-ca.pem etcd.pem etcd-key.pem; do
       scp -P 22 -r /etc/etcd/ssl/$FILE root@$NODE:/etc/etcd/ssl/
   done;
   for FILE in pki/ca.pem pki/ca-key.pem pki/front-proxy-ca.pem bootstrap-kubelet.kubeconfig; do
       scp -P 22 -r /etc/kubernetes/$FILE root@$NODE:/etc/kubernetes/${FILE}
   done;
done
