#!/bin/bash

MasterNodes='k8s-master01 k8s-master02 k8s-master03'
for NODE in $MasterNodes; do
    echo $NODE;
    scp -P 22 -r /usr/local/bin/kube{let,ctl,-apiserver,-controller-manager,-scheduler,-proxy} root@$NODE:/usr/local/bin/; 
    scp -P 22 -r /usr/local/bin/etcd* root@$NODE:/usr/local/bin/;
    sshpass ssh -p 22 root@${NODE} 'mkdir -p /opt/cni/bin && mkdir -p /etc/kubernetes/pki && mkdir -p /etc/etcd/ssl';
    # -o StrictHostKeyChecking=no
done
WorkNodes='k8s-node01 k8s-node02 k8s-node03'
for NODE in $WorkNodes; do
    echo $NODE;
    scp -P 22 -r /usr/local/bin/kube{let,-proxy} root@$NODE:/usr/local/bin/;
    sshpass ssh -p 22 root@${NODE} 'mkdir -p /opt/cni/bin && mkdir -p /etc/kubernetes/pki';
done
