fix: added sudo to kubectl commands
Deploy k8s Bootstrap / Pulumi Preview (pull_request) Successful in 31s
Deploy k8s Bootstrap / Bootstrap k3s Cluster (pull_request) Has been skipped

This commit is contained in:
2026-05-30 19:16:36 +02:00
parent 7212e0e3ef
commit 2f6635aa73
+6 -6
View File
@@ -92,13 +92,13 @@ const waitMaster1Ssh = new command.local.Command("wait-ssh-master-1", {
const installMaster1 = new command.remote.Command("install-k3s-master-1", { const installMaster1 = new command.remote.Command("install-k3s-master-1", {
connection: conn(master1Ip), 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], triggers: [master1VmId],
}, { dependsOn: [waitMaster1Ssh] }); }, { dependsOn: [waitMaster1Ssh] });
const waitK3sMaster1Ready = new command.remote.Command("wait-k3s-master-1-ready", { const waitK3sMaster1Ready = new command.remote.Command("wait-k3s-master-1-ready", {
connection: conn(master1Ip), 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], triggers: [master1VmId],
}, { dependsOn: [installMaster1] }); }, { 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", { const joinMaster2 = new command.remote.Command("join-k3s-master-2", {
connection: conn(master2Ip), 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], triggers: [master2VmId],
}, { dependsOn: [waitMaster2Ssh] }); }, { dependsOn: [waitMaster2Ssh] });
const joinMaster3 = new command.remote.Command("join-k3s-master-3", { const joinMaster3 = new command.remote.Command("join-k3s-master-3", {
connection: conn(master3Ip), 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], triggers: [master3VmId],
}, { dependsOn: [waitMaster3Ssh, joinMaster2] }); }, { 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", { const joinWorker1 = new command.remote.Command("join-k3s-worker-1", {
connection: conn(worker1Ip), 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], triggers: [worker1VmId],
}, { dependsOn: [waitWorker1Ssh] }); }, { dependsOn: [waitWorker1Ssh] });
const joinWorker2 = new command.remote.Command("join-k3s-worker-2", { const joinWorker2 = new command.remote.Command("join-k3s-worker-2", {
connection: conn(worker2Ip), 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], triggers: [worker2VmId],
}, { dependsOn: [waitWorker2Ssh] }); }, { dependsOn: [waitWorker2Ssh] });