1. Packages
  2. Azure Classic
  3. How-to Guides
  4. Azure Kubernetes Service (AKS) Cluster with Diagnostics

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

Azure Kubernetes Service (AKS) Cluster with Diagnostics

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    This example demonstrates creating an Azure Kubernetes Service (AKS) Cluster, and enables diagnostics for the cluster. Please see https://docs.microsoft.com/en-us/azure/aks/ for more information about AKS.

    Prerequisites

    Ensure you have downloaded and installed the Pulumi CLI.

    We will be deploying to Azure, so you will need an Azure account. If you don’t have an account, sign up for free here. Follow the instructions here to connect Pulumi to your Azure account.

    Running the Example

    After cloning this repo, cd into it and run these commands. A Kubernetes cluster and Apache web server will appear!

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

      $ pulumi stack init
      
    2. Set the required configuration variables for this program:

      $ pulumi config set azure:environment public
      $ pulumi config set password --secret [your-cluster-password-here]
      $ ssh-keygen -t rsa -f key.rsa
      $ pulumi config set sshPublicKey < key.rsa.pub
      
    3. Deploy everything with the pulumi up command. This provisions all the Azure resources necessary, including an Active Directory service principal, AKS cluster, and then enables diagnostics for the cluster, all in a single gesture:

      $ pulumi up
      
    4. After a couple minutes, your cluster and Apache server will be ready. Your kubeconfig will be the application output and you may also configure your kubectl client using the kubeconfig configuration:

      $ pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml
      $ kubectl get namespaces
      ....
      
    5. At this point, you have a running cluster. Feel free to modify your program, and run pulumi up to redeploy changes. The Pulumi CLI automatically detects what has changed and makes the minimal edits necessary to accomplish these changes. This could be altering the existing chart, adding new Azure or Kubernetes resources, or anything, really.

    6. Once you are done, you can destroy all of the resources, and the stack:

      $ pulumi destroy
      $ pulumi stack rm
      
    azure logo

    We recommend using Azure Native.

    Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi