pull/468/head
Mehdi BEN ABDALLAH 2019-06-26 18:29:02 +02:00
parent dbd6c90b59
commit 8ac3a99661
2 changed files with 35 additions and 0 deletions

View File

@ -45,10 +45,14 @@ It should be able to get you to a working single master (insecure) kubernetes se
- copy kubelet & kube-proxy on the worker nodes
```sh
./scripts/copy_file_to_nodes ./kubernetes/workers worker
./scripts/run_command_on_nodes 'sudo mv ~/workers/* /usr/bin/ && rmdir ~/workers' worker
```
- copy etcd, kubelet, kube-proxy, apiserver, scheduler and native controllers binaries to the master nodes
```sh
./scripts/copy_file_to_nodes ./etcd3 master
./scripts/run_command_on_nodes 'sudo mv ~/etcd3/* /usr/bin/ && rmdir ~/etcd3' master
./scripts/copy_file_to_nodes ./kubernetes/masters master
./scripts/run_command_on_nodes 'sudo mv ~/masters/* /usr/bin/ && rmdir ~/masters' master
```

31
scripts/run_command_on_nodes Executable file
View File

@ -0,0 +1,31 @@
#!/usr/bin/env bash
SCRIPTS_DIR=$(dirname $0)
MY_COMMAND="$1"
NODE_NAMES_FILTER="$2"
NODE_NAMES="$($SCRIPTS_DIR/node_names $NODE_NAMES_FILTER)"
echo "Will run the following command on $(echo $NODE_NAMES | xargs):"
echo "$MY_COMMAND"
echo ""
echo ""
read -n 1 -s -r -p "Press any key to continue..."
echo ""
# remotely run the script
pushd $SCRIPTS_DIR &> /dev/null
tmp_file=$(mktemp)
cat << WRAPPER_EOF > $tmp_file
#!/usr/bin/env bash
$MY_COMMAND
WRAPPER_EOF
yes | ./run_script_on_nodes "$(basename $tmp_file)" "$NODE_NAMES_FILTER" &> /dev/null
rm -rf $tmp_file
popd &> /dev/null