sparse-intern-71089
10/31/2023, 4:14 PMnarrow-monitor-83965
11/01/2023, 8:06 AMconst kubeConfigFile = pulumi.getStack() === "prod" ? "./kube/config" : "./kube/config-dev"
const kubeconfg = new local.Command("copy-kubeconfig", {
create: pulumi.interpolate`
mkdir -p ./kube
scp -o StrictHostKeyChecking=no -i "${tlsKey.privateKeyOpenssh}" root@${k3sMaster1.ipv4Address}:/etc/rancher/k3s/k3s.yaml ${kubeConfigFile}
sed -i 's/127.0.0.1/${k3sMaster1.ipv4Address}/' ${kubeConfigFile}
cat ${kubeConfigFile}
`
}, {
dependsOn: [k3sMaster1Install]
})
Then I used the stdout as export for my output.
module.exports = {
kubeconfig: kubeconfg.stdout.apply(x => x.toString()),
}
Not sure if the apply
is required, but it works.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by