How do you connect to a e.g. AKS cluster after it ...
# kubernetes
How do you connect to a e.g. AKS cluster after it has been created by pulumi?
You have to use a function to pull the credentials, and then build a Kubeconfig from those credentials. Have a look at one of the
templates in the Pulumi templates repository ( for an example of how to do that.
Once you have the Kubeconfig, then you can build a Kubernetes provider that uses it, or pass it to
for CLI access.
One additional note: by default, the Kubeconfig created by AKS uses a
configuration and won’t leverage the Azure CLI authentication. See this blog post to switch it (which makes it a tad easier IMO):
Thanks Scott! We're currently connecting using the Command package that's in preview. And then calling
az aks get-credentials
through that. But that throws an error so maybe not the way to do it...
Thanks a lot for pointing at the templates. I wish we would've seen those a long time ago 🙂
You should be able to “steal” code from the templates to add to your own projects in order to generate a Kubeconfig. Let us know if you need some help in that direction.