Search code examples
kubernetesazure-aks

Creating an AKS Cluster using C#?


I have not found a way to do so using C# K8s SDK: https://github.com/kubernetes-client/csharp

How to create a AKS Cluster in C#? Basically, the following command:

az aks create -g $RESOURCE_GROUP -n $AKS_CLUSTER \
    --enable-addons azure-keyvault-secrets-provider \
    --enable-managed-identity \
    --node-count $AKS_NODE_COUNT \
    --generate-ssh-keys \
    --enable-pod-identity \
    --network-plugin azure

Solution

  • Sending a PUT request with payload (JSON body) to ARM. See this: https://learn.microsoft.com/en-us/rest/api/aks/managed-clusters/create-or-update?tabs=HTTP