Skip to content

Commit

Permalink
Update install-kube-k3s-agent-u22-wg.sh
Browse files Browse the repository at this point in the history
Updated k3s agent install script to wait for WIREGUARD_VPN_IP
  • Loading branch information
robert-sanfeliu authored Dec 2, 2024
1 parent 53dfd6b commit 57f7458
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion k3s/install-kube-k3s-agent-u22-wg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ log_print(){
}

log_print INFO "Installing k3s agent"
WIREGUARD_VPN_IP=`ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1`

while true; do
WIREGUARD_VPN_IP=$(ip a | grep wg | grep inet | awk '{print $2}' | cut -d'/' -f1)
if [[ -n "$WIREGUARD_VPN_IP" ]]; then
log_print INFO "WIREGUARD_VPN_IP is set to $WIREGUARD_VPN_IP"
break
fi
log_print INFO "Waiting for WIREGUARD_VPN_IP to be set..."
sleep 1
done

curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=${K3S_VERSION} K3S_URL="https://${WIREGUARD_SERVER}:6443" K3S_TOKEN=${NODE_TOKEN} INSTALL_K3S_EXEC="--node-ip $WIREGUARD_VPN_IP" sh -

Expand Down

0 comments on commit 57f7458

Please sign in to comment.