Worker sh

This commit is contained in:
2026-02-24 10:36:21 +01:00
parent 73bb9c2fc7
commit 0dc30a6aae

View File

@@ -1,10 +1,13 @@
echo "⏳ Esperant que el Master generi el token..."
while [ ! -f /vagrant/node-token ]; do sleep 2; done
#Anem a buscar el node token al Master
sudo cat /var/lib/rancher/k3s/server/node-token
K3S_TOKEN=$(cat /vagrant/node-token)
NODE_IP=$(ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
echo "⏳ Esperant que el Master generi el token..."
while [ ! -f /vagrant/node-token ]; do sleep 2; done
echo "🚀 Instal·lant K3s Agent (Worker) connectant a #{IP_MASTER}..."
curl -sfL https://get.k3s.io | K3S_URL=https://#{IP_MASTER}:6443 K3S_TOKEN=$K3S_TOKEN sh -s - --node-ip $NODE_IP --flannel-iface eth1
K3S_TOKEN=$(cat /vagrant/node-token)
NODE_IP=$(ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
echo "✅ Worker unit al clúster!"
echo "🚀 Instal·lant K3s Agent (Worker) connectant a #{IP_MASTER}..."
curl -sfL https://get.k3s.io | K3S_URL=https://#{IP_MASTER}:6443 K3S_TOKEN=$K3S_TOKEN sh -s - --node-ip $NODE_IP --flannel-iface eth1
echo "✅ Worker unit al clúster!"