It's possible to have the same pulumi stack to cre...
# kubernetes
m
It's possible to have the same pulumi stack to create a GKE cluster (
gcp.container.Cluster
) and a usable kubernetes provider (
kubernetes.Provider
) for that same cluster in the same run? I'm getting
Copy code
error: kubernetes:<http://helm.sh/v4:Chart|helm.sh/v4:Chart> resource 'external-dns' has a problem: 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/>

     invalid configuration: [context was not found for specified context: gke_xxxxxx_us-central1-a_main, cluster has no server defined]
    error: Program failed with an unhandled exception:
I can't find a way to make the kubernetes.Provider wait to until the cluster is actually created and the
~/.kube/config
updated. I have a
command.local.Command
that runs after the
gcp.container.Cluster
and updates the kubeconfig, But it seems that pulumi want to read the kubeconfig before it's updated. I want to do this in the same stack if possible as this is a stack that I have for testing so I want to created and destroy in the same day. (I already verified that if I comment the helm chart part, I can create the gke cluster and if I then uncomment the chart then the helm release is created since the kubeconfig is already updated in the second run).
nevermind , it seems to work as long as I skip the preview with
pulumi up --skip-preview'
but is there any way to make it work with preview?
s
You'll want to use inputs/outputs instead of pausing manually: Use
apply
to create the Kubeconfig text once the cluster is ready, then, because explicit providers are also Pulumi resources use the Kubeconfig (which is itself Output<string>) to construct the K8s provider.
m
@stocky-restaurant-98004 I was alreeady using input/output for the
kubernetes.Provider
, the problem was that the
kubernetes.helm.v4.Chart
was not using that provider, I forgot to put
opts=pulumi.ResourceOptions(provider=kubernetes_provider)
so it was trying to use the default kubernetes provider.
👍 1