I have a quick question regarding multiple k8s clu...
# general
q
I have a quick question regarding multiple k8s clusters. On my local machine my kubeconfig has multiple, so when running
pulumi up --stack dev
I accidentally targeted another cluster since my local context was pointing not to
dev
. Thinking ahead and hoping to avoid this, storing the
kubeconfig
in pulumi config seems like a good move (as described https://www.pulumi.com/registry/packages/kubernetes/installation-configuration/), though I'm not comfortable setting that in plain text and committing to source control. Does the kubernetes provider allow reading the
kubernetes:kubeconfig
as a secret?
p
you can explicitly create a kubernetes provider and feed it with kubeconfig from whenever you want (that includes getting it from stack secrets)
the downside of this approach is that you cannot set this provider as default (or at least it wasn’t possible - I didn’t track the issue) so you have to pass it to all resources using
opts
😵 1
Btw, did you try to set
kubernetes:kubeconfig
as a secret? I haven’t tested that but it might actually work.
🙌 1
just save it using
pulumi set
command with
--secret
flag and see if it works out of the box with the default k8s provider 🙂
e
There's an issue about disabling the default providers via some setting so that you'd have to pass kubeconfig explicitly somehow: https://github.com/pulumi/pulumi/issues/3383
And another issue to let the program set the default providers: https://github.com/pulumi/pulumi/issues/2059
q
Thanks both
Was hoping someone could comment on whether your trick of setting it as a secret worked.
But seems like it's more involved than just setting that value in the config
I'm using circle-ci to do automated deployments and typically wouldn't use pulumi to deploy to my prod cluster from my local machine.
Just got tripped up while debugging resource renaming and setting dependencies correctly
in circle-ci I use contexts to set the
KUBECONFIG
so it selects the correct cluster depending on the branch I commit to