06/18/2021, 1:45 PM
Hello Everyone! Is there any way to obtain kubeconfig from Pulumi in the code? I want to make an API call to an EKS server while Pulumi is running, but I need a kubeconfig for that. I've tried to get it from 'cluster.kubeconfig', but haven't succeeded.


06/18/2021, 7:14 PM
I believe if you need to use the kubeconfig for something that is not a Pulumi provider (i.e. using the kubeconfig` as an input to create a provider), you’d probably want to use the Automation API, where you would run your stack, have it export the kubeconfig, and then use that exported value in your code once the stack has run. While Pulumi is running I’m not sure it’s possible to get the concrete value of kubeconfig, since the cluster may not have been created yet, as resource creation is async
Alternatively, you could do this inside an
call, since that will resolve the kubeconfig and give you access to it.