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

calm-ability-6566

03/11/2024, 1:07 PM
Hi, I'm trying to load an existing namespace in my k8s cluster. I'm using
kubernetes.core.v1.Namespace.get("my-namespace", k8sProvider.id)
to do that but for some reason pulumi tries to access some other namespace I'm not having access to which results into an
error: namespaces "<other-namespace>" is forbidden: User "<my-user>" cannot get resource "namespaces" in API group "" in the namespace "<other-namespace>"
Has someone an idea why this happens? I used the same user for Terraform and terraform was able to load the namespace.
d

dry-keyboard-94795

03/11/2024, 1:31 PM
In your example, is "my-namespace" the name of the namespace you're expecting to fetch?
The first parameter is the name of the pulumi resource, for tracking in state. The second parameter is the name of the namespace. As you have a k8s provider, this should go in the third parameter, which is the resource options.
Copy code
.get("my-namespace", "my-namespace", {provider: k8sProvider})
c

calm-ability-6566

03/11/2024, 1:59 PM
That makes sense 😄 thank you