Hi everyone, I have a noob question about deployin...
# getting-started
h
Hi everyone, I have a noob question about deploying to Kubernetes. How do I set the namespace and cluster to deploy into? Pulumi keeps trying to deploy in the "default" namespace, which I don't have permissions on. Setting my namespace like so didn't seem to do anything:
metadata=ObjectMetaArgs(labels=app_labels, namespace="mynamespace")
Thanks a lot in advance!
b
are you using the default provider?
if so, you can configure it in, well, your config something like
pulumi config set kubernetes:namespace foo
Otherwise if you create a provider programatically, it's one of the arguments: https://www.pulumi.com/docs/reference/pkg/kubernetes/provider/#namespace_nodejs
h
Thank you very much @bumpy-summer-9075!
pulumi config set kubernetes:namespace foo
did the trick! I'm using the default provider and had set my context via
kubectl config use-context
and
pulumi config set kubernetes:context
but for some reason it kept using the "default" context.
b
De rien 🙂
I'm keeping my eye on https://github.com/pulumi/pulumi/issues/2059 I really don't like that the default provider uses my local
kubectl
👀 1
h
Thanks for the hint, I'll gladly join watching that one! I've just started using Pulumi this week and am working through one of the tutorials in the official docs. It makes using the local kubeconfig look super simple but with the info in the GitHub issue and my experience that Pulumi does not even read the current context correctly from kubeconfig, working with explicitly configured providers seems to be the way to go in any case.
b
can you sharw your full code @high-diamond-73999? setting the namespace via objectmetaargs should work
👍 1
☝️ 1
h
@billowy-army-68599 Thanks for your interest! I'll share my code asap :)
Hi @billowy-army-68599 sorry for the delay - I was on vacation. Here is my main.py: https://pastebin.com/jVD86zDR If you need further files, let me know!
As mentioned above, I unsuccessfully tried the following on line 16 before:
metadata=ObjectMetaArgs(labels=app_labels, namespace="mynamespace")