Can anyone point me to docs which explains how to ...
# general
Can anyone point me to docs which explains how to create a provider object from an eks cluster which I can pass around to create my k8s resources in golang? Googling gives me outdated examples (v2 vs v3) and the pulumi doc site doesn’t seem to provide the import statements for the code snippets. Thanks!
Try this, it’s some code I got from @billowy-army-68599 to do exactly what you’re describing. I haven’t tested it, but it should work. I believe it’s intended to be used with our EKS component:
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,
That’s really helpful, thanks! One question though, where is
coming from? I see you reference
. Are they are the same cluster object being created with
Yeah, that’s probably a bug. 🐛 AIUI, you should be referencing the same cluster object in both places.
Oh it may not matter since
is just the provider name. I can hard code that to a string. Thanks!
This may be diving a bit deep into the weeds, but when I create k8s resources with the passed provider, why can’t I pass
when I’m using my local (minikube) setup?
Copy code
_, err = corev1.NewNamespace(ctx, namespace, &corev1.NamespaceArgs{
		Metadata: &metav1.ObjectMetaArgs{
			Name: pulumi.String("dev"),
	}, pulumi.Provider(provider))
“panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x16c4b00]”
go seems to think this is a perfectly legal statement, but maybe the library isn’t checking for nil?
That sounds like a bug, please file an issue (if you don’t mind)