https://pulumi.com logo
#general
Title
# general
c

cuddly-smartphone-89735

01/20/2020, 2:03 PM
Hi. Iโ€™m trying to initialize the k8s provider's
kubeconfig
parameter with the output of a Azure
KubernetesCluster
resource. But for some reason, when I run
pulumi up
before even provisioning anything, it fails because the
k8s
resource already tries to connect to the cluster (which doesn't exist at this point in time). I thought that a missing dependency was the issue, but even when I specify the dependency explicitly, it will fail with the connection error. Any ideas? Basically I just want to provision a cluster (with azure provider) and then configure that same cluster (with k8s provider).
b

better-rainbow-14549

01/20/2020, 2:07 PM
i do this and havent had any issues, do you want to pastebin some code?
c

cuddly-smartphone-89735

01/20/2020, 2:07 PM
l

limited-rainbow-51650

01/20/2020, 2:08 PM
create the k8s provider based on an output from the cluster resource. This is a snippet of working code
Copy code
// Expose a k8s provider instance of the cluster.
this.provider = new k8s.Provider(`${name}-aks`, {
     kubeconfig: this.cluster.kubeConfigRaw,
}, { parent: this });
b

better-rainbow-14549

01/20/2020, 2:08 PM
specify the provider ConfigFile explicitly - it's likely coming from an ambient provider instead
{ dependsOn: [cluster], provider: cluster }
there's a long-standing issue where unless you specify it, an ambient one from your current env. will be used
c

cuddly-smartphone-89735

01/20/2020, 2:10 PM
Aaah, yes,
provider: cluster
did the trick! Awesome! Thatโ€™s what I was looking for.
b

better-rainbow-14549

01/20/2020, 2:10 PM
remember to do it for everything ๐Ÿ˜„
there is a workaround so that it will fail-fast if you forget but i can't remember what it is
c

cuddly-smartphone-89735

01/20/2020, 2:10 PM
Yes, good that Iโ€™m only getting started. Learning early. ๐Ÿ˜„
b

better-rainbow-14549

01/20/2020, 2:10 PM
i need to start using that myself actually
c

cuddly-smartphone-89735

01/20/2020, 2:11 PM
Well thank you very much for the help ๐Ÿ˜Š
๐Ÿ‘ 1
w

white-balloon-205

01/20/2020, 7:34 PM
2 Views