From 297e1765bb2defbf6b22d8d63aeb0346656a1c62 Mon Sep 17 00:00:00 2001 From: Guillem Hernandez Sola Date: Tue, 24 Feb 2026 11:04:18 +0100 Subject: [PATCH] Added all --- k3s_master.sh | 2 +- k3s_worker.sh | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/k3s_master.sh b/k3s_master.sh index cf44d5b..3ca4e60 100644 --- a/k3s_master.sh +++ b/k3s_master.sh @@ -1,6 +1,6 @@ echo "🚀 Instal·lant K3s Server (Master)..." -curl -sfL https://get.k3s.io | sh - +curl -sfL https://get.k3s.io | sh -s - server --tls-san 192.168.3.10 sudo chown vagrant:vagrant /etc/rancher/k3s/k3s.yaml export KUBECONFIG=/etc/rancher/k3s/k3s.yaml diff --git a/k3s_worker.sh b/k3s_worker.sh index 30e942d..af98fd9 100644 --- a/k3s_worker.sh +++ b/k3s_worker.sh @@ -1,13 +1,9 @@ #Anem a buscar el node token al Master sudo cat /var/lib/rancher/k3s/server/node-token - -echo "⏳ Esperant que el Master generi el token..." -while [ ! -f /vagrant/node-token ]; do sleep 2; done - -K3S_TOKEN=$(cat /vagrant/node-token) -NODE_IP=$(ip addr show eth1 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1) + +K3S_TOKEN=algun_string_random::server:segon_string_random 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 - +curl -sfL https://get.k3s.io | K3S_URL=https://192.168.3.10:6443 K3S_TOKEN=$K3S_TOKEN sh - + echo "✅ Worker unit al clúster!" \ No newline at end of file