Im using WIF in my gitlab pipeline. I use pulumi Y...
# getting-started
s
Im using WIF in my gitlab pipeline. I use pulumi YAML. I create gke cluster with
type: gcp:container:Cluster
How to create a namespace with pulumi with
type: kubernetes:core/v1:Namespace
. My main question is how to tell
pulumi type: kubernetes:core/v1:Namespace
to deploy namespace to this cluster pulumi created? I can use kubectl but I would like pulumi to manage that.
I dont understand how to get a kubeconfig from
gcp:container:Cluster
and pass it to
kubernetes:core/v1:Namespace
done it
Can anyone help?
Copy code
name: lgtm-monitoring
runtime: yaml

resources:

  provider:
    type: pulumi:providers:kubernetes
    properties:
      cluster: ${lgtm-monitoring-cluster.id}

.
.
.
vpc
subnet
etc
.
.
.

  lgtm-monitoring-cluster:
    type: gcp:container:Cluster
    properties:
      ...

  namespace-lgtm:
    type: kubernetes:core/v1:Namespace
    properties:
      metadata:
        name: lgtm
    options:
      provider: ${provider}
Error:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (lgtm-monitoring-monitoring):
    error: update failed

  kubernetes:core/v1:Namespace (namespace-lgtm):
    error: configured Kubernetes cluster is unreachable: unable to load Kubernetes client configuration from kubeconfig file. Make sure you have:
    
         • set up the provider as per <https://www.pulumi.com/registry/packages/kubernetes/installation-configuration/>
    
     cluster "projects/lgtm/locations/europe-west2/clusters/lgtm-monitoring-cluster-6fae4ee" does not exist

Outputs:
    clusterName: "lgtm-monitoring-cluster-6fae4ee"
    projectId  : "lgtm"
    region     : "europe-west2"
Cluster definitely does exist.
m
You need to instantiate a Kubernetes provider using the cluster's kubeconfig, not just the cluster's ID. Have a look at https://www.pulumi.com/registry/packages/kubernetes/installation-configuration/
s
finally figured this out. Namespace created. Thank you.