Deploy the quickstart-python helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the
quickstart-python
Helm chart on Azure Kubernetes Service (AKS), we'll need to perform a few steps:- Create an AKS cluster using the
azure-native
provider. - Install the Helm chart on the AKS cluster.
Here are the steps in detail:
Step 1: Create an AKS Cluster
We'll start by creating an instance of
azure.containerservice.KubernetesCluster
. This represents the AKS cluster in our Pulumi program.Step 2: Deploy a Helm Chart onto the AKS Cluster
Once the AKS cluster is up and running, we'll need to configure Pulumi to use the cluster's kubeconfig to deploy resources into it. Pulumi does this by leveraging the
kubernetes
provider. We will then use thekubernetes.helm.v3.Chart
resource to deploy our Helm chart. In this case, thequickstart-python
Helm chart.Now, let's write the Pulumi program in TypeScript to perform these actions. The program below assumes that you've already configured Pulumi for Azure with the needed credentials and have the Pulumi CLI installed.
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an AKS Cluster const aksCluster = new azure.containerservice.KubernetesCluster("aksCluster", { // Define your resource group name where the AKS cluster will be created resourceGroupName: "yourResourceGroupName", // Define your AKS cluster properties defaultNodePool: { vmSize: "Standard_DS2_v2", minCount: 1, maxCount: 2, enableAutoScaling: true, }, // Add more configurations for AKS as per your requirements dnsPrefix: "aks-example", // Add Kubernetes version you wish to deploy kubernetesVersion: "1.20.9" }); // Export the kubeconfig for local use export const kubeconfig = aksCluster.kubeConfigRaw; // Step 2: Deploy the quickstart-python Helm chart to the AKS cluster const helmChart = new k8s.helm.v3.Chart("quickstart-python", { // Specify the Helm chart details chart: "quickstart-python", version: "0.1.0", // use the chart version you need fetchOpts:{ repo: "http://helm-repo-path/", // specify the Helm repo URL if the chart is not from the default repo }, // Pass the values to the Helm chart, if any values: { serviceType: "LoadBalancer", }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: kubeconfig }) }); // Optionally, you can export the Helm release status export const helmStatus = helmChart.status;
In this program:
- We're creating an AKS cluster with an autoscaling node pool in Azure.
- We're fetching and exporting the kubeconfig of the cluster so it can be used outside of the Pulumi program if needed.
- We're deploying the Helm chart
quickstart-python
to our AKS cluster. The chart details should be customized with real values specific to your Helm chart. Forrepo
, use the actual Helm repository wherequickstart-python
is hosted. - Note that the
helmChart
resource is making use of a k8s provider configured with the kubeconfig from our newly created AKS cluster, ensuring that it deploys the Helm chart to the right place. - We're also exporting the status of the Helm deployment which could be useful for CI/CD pipelines or for programmatic checks.
Remember to replace placeholders like
yourResourceGroupName
andhttp://helm-repo-path/
with your actual Azure resource group name and Helm repository URL where thequickstart-python
chart is located.After defining your resources in the Pulumi program, you would run
pulumi up
to create the resources in Azure, deploy your Helm chart on AKS, and see the outputs of the deployment process.- Create an AKS cluster using the