1. Packages
  2. Azure Native
  3. How-to Guides
  4. Azure Kubernetes Service (AKS) Cluster using the native Azure Provider
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi

Azure Kubernetes Service (AKS) Cluster using the native Azure Provider

azure-native logo
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    This example deploys an AKS cluster, creates an Azure Active AD application, creates a Service Principal and sets credentials to manage access to the cluster.

    Deploying the App

    To deploy your infrastructure, follow the below steps.

    Prerequisites

    1. Install Pulumi
    2. Configure Azure Credentials

    Steps

    After cloning this repo, from this working directory, run these commands:

    1. Create a new stack, which is an isolated deployment target for this example:

      $ pulumi stack init dev
      
    2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

      $ az login
      
    3. Set the azure location in which to run the test:

      $ pulumi config set azure-native:location westus2
      
    4. Stand up the cluster by invoking pulumi

      $ pulumi up
      
    5. After 3-4 minutes, your cluster will be ready, and the kubeconfig YAML you’ll use to connect to the cluster will be available as an output. You can save this kubeconfig to a file like so:

      $ pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml
      

      Once you have this file in hand, you can interact with your new cluster as usual via kubectl:

      $ KUBECONFIG=./kubeconfig.yaml kubectl get nodes
      
    6. From there, feel free to experiment. Simply making edits and running pulumi up will incrementally update your stack.

    7. Once you’ve finished experimenting, tear down your stack’s resources by destroying and removing it:

      $ pulumi destroy --yes
      $ pulumi stack rm --yes
      
    azure-native logo
    This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
    Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi