-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk3sup-node-deploy.sh
executable file
·43 lines (37 loc) · 1.33 KB
/
k3sup-node-deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
export SERVER_IP=$1
export TARGET_USER=$2
export SSH_KEY=$3
export NODE_IP=$4
export K3S_VERSION=$5
if [ -z "$SERVER_IP" -o -z "$TARGET_USER" -o -z "$SSH_KEY" ]; then
echo
echo " " Syntax is:
echo " " `basename $0` "SERVER_IP TARGET_USER SSH_KEY [NODE_IP]"
echo
echo " Prerequisites:"
echo " TARGET_USER must exist on both SERVER_IP (and NODE_IP if doing a worker node install)"
echo " TARGET_USER must have passwordless sudo permissions on the SERVER_IP (and NODE_IP if doing a worker install) - you can remove this permission after installation is complete"
echo " SSH_KEY should be a non-rsa key that allows access to the SERVER_IP (and NODE_IP if doing a worker install)"
echo
exit 1
fi
if [ ! -f $SSH_KEY ]; then
echo
echo " File does not exist: $SSH_KEY"
echo
exit 1
fi
if [ x$K3S_VERSION != x ]; then
export K3SUP_VERSION_ARG="--k3s-version $K3S_VERSION"
fi
echo " SERVER_IP: $SERVER_IP"
echo " TARGET_USER: $TARGET_USER"
echo " SSH_KEY: $SSH_KEY"
echo " NODE_IP: $NODE_IP"
$echo echo Running `basename $0`:
if [ -z $NODE_IP ]; then
$echo k3sup install --ip $SERVER_IP --user $TARGET_USER --ssh-key $SSH_KEY --local-path ./kubeconfig
else
$echo k3sup join --ip $NODE_IP --server-ip $SERVER_IP --user $TARGET_USER --ssh-key $SSH_KEY $K3SUP_VERSION_ARG
fi