Title
b

better-shampoo-48884

04/07/2021, 7:31 AM
So - I'm hitting the first trial of "getting started with pulumi for kubernetes" 🙂 I've created a namespace - with pulumi - and now it wants to recreate it, even though it exists. How can I ensure that it doesn't try to do that again (since it currently fails because it already exists). Basically, it seems to have gotten deleted from the stack (i've done a few destroys and ups and backs and forths), thus is not populated in refresh, and attempts to create it fail because it already exists.
g

gentle-diamond-70147

04/07/2021, 2:40 PM
If you created the namespace with Pulumi, Pulumi should not be attempting to re-create it. Pulumi keeps track of your resources in different stacks (https://www.pulumi.com/docs/intro/concepts/stack/) which is how Pulumi remembers the resources that have been created. If you create a namespace in one stack, then
pulumi stack init ...
a new stack, Pulumi will not be aware of the existing namespace in that new stack.
Is it possible you changed the stack you're acting on?
If you run
pulumi stack
, do you see the
Namespace
resource?
b

better-shampoo-48884

04/08/2021, 2:13 PM
Well aware of that, and it was most likely due to the
provider
being omitted from some of the commands, so the stack got confused as to the real target when I added the provider to all the resource requests. In any event, it would be nice to perhaps have an
importIfExists
option for kubernetes stuff - there likely won't be any full-fledged ID that would be pulled out, but I know there's some discussion still ongoing for `patch`vs
apply
vs
create
operational methods
1