Crossposted from <#CJ909TL6P|typescript> <https://...
# kubernetes
I just hit something similar in Go, where I had to essentially get the kubeconfig out of the cluster as a string using an Apply I think this issue helped me a bit -
In Go, this ended up looking like:
Copy code
// Save a kube provider for later use
	kubeconfig := cluster.Kubeconfig.ApplyT(func(k interface{}) (string, error) {
		data, err := json.Marshal(k)
		if err != nil {
			return "", fmt.Errorf("kubeconfig is not a string")
		return string(data), nil

	kubeProvider, err := kubernetes.NewProvider(ctx, awsCluster.Name, &kubernetes.ProviderArgs{
		Kubeconfig: kubeconfig,
It looks like this is what I'm doing (although in TypeScript) but what I get is a kubeProvider that is somewhat 'poisoned', in that it appears to work, but if I create a resource with it, I get that odd error from inside Pulumi
It does seem like that linked issue might clear things up when it's fixed? Since I could use apply to turn the Output<string> of the kubeconfig into an Output<KubernetesProvider> and use that
Interesting. That sounds right, but it also seems like that might be a long while (they link another blocking issue in there). It's a bit beyond my full understanding though
@brief-vr-24049: What kind of cluster are you creating? (EKS, GKS, AKS? Something else?) Not sure about the others, but if you’re dealing with EKS and use the
package, you get a
output you can use as a resource option for future K8S operations like:
Copy code
cluster = new eks.Cluster(...);

k8sThing = new k8s.core.v1...({args}, {provider: cluster.provider});
It's kops, unfortunately, which doesn't seem to have an implementation out of the box. I'm making the cluster itself with a dynamic resource and then using an
on the output of that dynamic resource to look up the information to make a
, which is how I'm getting the
that is the kubeconfig.
This all works great if the cluster is already up. I'm guessing because even though it's an
, it already has a valid value