#!/bin/bash
for NODE in k8s-master01 k8s-master02 k8s-master03;do
    echo $NODE
    for FILE in $(ls /etc/kubernetes/pki | grep -v etcd);do
        sshpass ssh -p 22 root@$NODE "mkdir -p /etc/kubernetes/pki"
        sshpass scp -P 22 -r /etc/kubernetes/pki/${FILE} root@$NODE:/etc/kubernetes/pki/${FILE};
    done;
done

echo "======================================================================================================="

for NODE in k8s-master01 k8s-master02 k8s-master03;do
    echo $NODE
    for FILE in admin.kubeconfig controller-manager.kubeconfig scheduler.kubeconfig;do
        sshpass scp -P 22 /etc/kubernetes/${FILE} root@$NODE:/etc/kubernetes/${FILE};
    done;
done
