https://pulumi.com logo
#azure
Title
# azure
h

helpful-gpu-85265

10/22/2023, 10:23 AM
hi guys, im trying to setup an AKS cluster then follow up and install a helm chart, i've managed to do the first,
managed_cluster = containerservice.ManagedCluster
creds = containerservice.list_managed_cluster_user_credentials_output(
resource_group_name=resource_group.name,
resource_name=managed_cluster.name)
encoded = creds.kubeconfigs[0].value
self.kubeconfig = encoded.apply(
lambda enc: base64.b64decode(enc).decode())
pulumi.export("kubeconfig", self.kubeconfig)
but how do I fetch kubeconfig to be used by the Helm release ?
helm_release = Release(
"traefik",
ReleaseArgs(XXX
),
ResourceOptions(provider=k8s_provider),
)
I think this is related to Output feature, but I'm lost
b

bumpy-glass-30283

10/23/2023, 3:48 PM
not sure if the ManagedCluster has the kubeconfig as a built-in property, what we did, is just created an output which gets you the azcli command:
Copy code
az_command = Output.all(aksResourceGroup.name, cluster.name).apply(
    lambda args: f"az aks get-credentials --resource-group {args[0]} --name {args[1]}"
)
also there's creds and kubeconfig outputs in this example: https://www.pulumi.com/registry/packages/kubernetes/how-to-guides/aks/
w

worried-knife-31967

10/23/2023, 5:23 PM
Here's an example of exactly that... Https://github.com/martinjt/aks-otel-demo
h

helpful-gpu-85265

10/24/2023, 11:52 AM
awesome, yes it worked i was looking for this:
Copy code
custom_provider = Provider(
    "inflation_provider", kubeconfig=kube_config
)
which I missed in the official tutorial Peter mentioned, I also liked how you structured the app Martin thanks a lot
3 Views