Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set a correct shell variable name for node_token (#7) #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions scripts/tools/400_install_k3s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ EOF
cat <<EOF > /opt/tools/k3s/02_add_all_nodes.sh
#!/usr/bin/env bash

node-token=\$(cat /var/lib/rancher/k3s/server/node-token)
node_token=\$(cat /var/lib/rancher/k3s/server/node-token)

IPS=(${CONFIG_CLUSTER_IPS})

for host in ${CONFIG_CLUSTER_IPS}; do
ssh ${CONFIG_SYSTEM_USER}@\$host 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node-token} sh -s - server https://\${IPS[0]}:6443'
ssh ${CONFIG_SYSTEM_USER}@\$host 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node_token} sh -s - server https://\${IPS[0]}:6443'
done

exit 0
Expand All @@ -33,7 +33,7 @@ EOF
cat <<EOF > /opt/tools/k3s/021_add_node.sh
#!/usr/bin/env bash

node-token=\$(cat /var/lib/rancher/k3s/server/node-token)
node_token=\$(cat /var/lib/rancher/k3s/server/node-token)

if [[ \$# -ne 1 ]]; then
echo "./\$0 <ip>"
Expand All @@ -42,9 +42,9 @@ fi

IPS=(${CONFIG_CLUSTER_IPS})

ssh ${CONFIG_SYSTEM_USER}@\$1 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node-token} sh -s - server https://\${IPS[0]}:6443'
ssh ${CONFIG_SYSTEM_USER}@\$1 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node_token} sh -s - server https://\${IPS[0]}:6443'

# ssh ${CONFIG_SYSTEM_USER}@\$1 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node-token} K3S_URL=https://\${IPS[0]}:6443 sh -
# ssh ${CONFIG_SYSTEM_USER}@\$1 'curl -sfL https://get.k3s.io | K3S_NODE_NAME=\\\$(hostname) K3S_TOKEN=\${node_token} K3S_URL=https://\${IPS[0]}:6443 sh -
# ssh -L 9999:127.0.0.1:8001 -N pi@192.168.2.201

exit 0
Expand Down