From 2f6635aa730c23e5f2db75b8889b0963859e09ad Mon Sep 17 00:00:00 2001 From: kasun Date: Sat, 30 May 2026 19:16:36 +0200 Subject: [PATCH] fix: added sudo to kubectl commands --- k8s-bootstrap/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/k8s-bootstrap/index.ts b/k8s-bootstrap/index.ts index 29c7737..7b6c063 100644 --- a/k8s-bootstrap/index.ts +++ b/k8s-bootstrap/index.ts @@ -92,13 +92,13 @@ const waitMaster1Ssh = new command.local.Command("wait-ssh-master-1", { const installMaster1 = new command.remote.Command("install-k3s-master-1", { connection: conn(master1Ip), - create: pulumi.interpolate`curl -sfL https://get.k3s.io | K3S_TOKEN='${k3sToken}' sh -s - server --cluster-init --tls-san ${master1Ip} --node-name k3s-master-1`, + create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --cluster-init --tls-san ${master1Ip} --node-name k3s-master-1`, triggers: [master1VmId], }, { dependsOn: [waitMaster1Ssh] }); const waitK3sMaster1Ready = new command.remote.Command("wait-k3s-master-1-ready", { connection: conn(master1Ip), - create: `for i in $(seq 1 60); do kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml get node k3s-master-1 --no-headers 2>/dev/null | grep -q " Ready" && exit 0; sleep 10; done; exit 1`, + create: `for i in $(seq 1 60); do sudo kubectl --kubeconfig /etc/rancher/k3s/k3s.yaml get node k3s-master-1 --no-headers 2>/dev/null | grep -q " Ready" && exit 0; sleep 10; done; exit 1`, triggers: [master1VmId], }, { dependsOn: [installMaster1] }); @@ -120,13 +120,13 @@ const waitMaster3Ssh = new command.local.Command("wait-ssh-master-3", { const joinMaster2 = new command.remote.Command("join-k3s-master-2", { connection: conn(master2Ip), - create: pulumi.interpolate`curl -sfL https://get.k3s.io | K3S_TOKEN='${k3sToken}' sh -s - server --server https://${master1Ip}:6443 --node-name k3s-master-2`, + create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --server https://${master1Ip}:6443 --node-name k3s-master-2`, triggers: [master2VmId], }, { dependsOn: [waitMaster2Ssh] }); const joinMaster3 = new command.remote.Command("join-k3s-master-3", { connection: conn(master3Ip), - create: pulumi.interpolate`curl -sfL https://get.k3s.io | K3S_TOKEN='${k3sToken}' sh -s - server --server https://${master1Ip}:6443 --node-name k3s-master-3`, + create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_TOKEN='${k3sToken}' sh -s - server --server https://${master1Ip}:6443 --node-name k3s-master-3`, triggers: [master3VmId], }, { dependsOn: [waitMaster3Ssh, joinMaster2] }); @@ -148,13 +148,13 @@ const waitWorker2Ssh = new command.local.Command("wait-ssh-worker-2", { const joinWorker1 = new command.remote.Command("join-k3s-worker-1", { connection: conn(worker1Ip), - create: pulumi.interpolate`curl -sfL https://get.k3s.io | K3S_URL=https://${master1Ip}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-1`, + create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_URL=https://${master1Ip}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-1`, triggers: [worker1VmId], }, { dependsOn: [waitWorker1Ssh] }); const joinWorker2 = new command.remote.Command("join-k3s-worker-2", { connection: conn(worker2Ip), - create: pulumi.interpolate`curl -sfL https://get.k3s.io | K3S_URL=https://${master1Ip}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-2`, + create: pulumi.interpolate`curl -sfL https://get.k3s.io | sudo K3S_URL=https://${master1Ip}:6443 K3S_TOKEN='${k3sToken}' sh -s - --node-name k3s-worker-2`, triggers: [worker2VmId], }, { dependsOn: [waitWorker2Ssh] });