Deploy the storageclass helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy a StorageClass Helm chart on Azure Kubernetes Service (AKS), you will need to do the following:
- Set up an Azure Kubernetes Service (AKS) cluster,
- Install and configure Helm in your local environment (assuming you have local access with the required permissions),
- Add the repository that contains the StorageClass chart, and
- Deploy the chart to your AKS cluster.
The Pulumi program below demonstrates how to create an AKS cluster using the
azure-native
provider. Once the AKS cluster is set up, we will install Helm on your local machine and use it to deploy the StorageClass Helm chart onto the AKS cluster. The instructions will be for running the Pulumi program, installing Helm, and deploying the chart.Here is the Pulumi program written in TypeScript to create an AKS cluster:
import * as pulumi from "@pulumi/pulumi"; import * as azuread from "@pulumi/azuread"; import * as azure_native from "@pulumi/azure-native"; import * as k8s from "@pulumi/kubernetes"; // Create a new resource group const resourceGroup = new azure_native.resources.ResourceGroup("my-resource-group"); // Create an AD service principal for the AKS cluster. const adApp = new azuread.Application("aks"); const adSp = new azuread.ServicePrincipal("aksSp", {applicationId: adApp.applicationId}); const adSpPassword = new azuread.ServicePrincipalPassword("aksSpPassword", { servicePrincipalId: adSp.id, endDate: "2099-01-01T00:00:00Z", }); // Create the AKS cluster. const cluster = new azure_native.containerservice.ManagedCluster("my-aks-cluster", { resourceGroupName: resourceGroup.name, agentPoolProfiles: [{ count: 2, maxPods: 110, mode: "System", name: "agentpool", osDiskSizeGB: 30, osType: "Linux", vmSize: "Standard_DS2_v2", }], dnsPrefix: "myakscluster", enableRBAC: true, kubernetesVersion: "1.18.14", linuxProfile: { adminUsername: "adminuser", ssh: { publicKeys: [{ keyData: "YOUR_SSH_PUBLIC_KEY", }], }, }, servicePrincipalProfile: { clientId: adApp.applicationId, secret: adSpPassword.value, }, }, {dependsOn: [adSpPassword]}); // Export the kubeconfig const creds = pulumi.all([cluster.name, resourceGroup.name]).apply(([clusterName, rgName]) => azure_native.containerservice.listManagedClusterUserCredentials({ resourceName: clusterName, resourceGroupName: rgName, })); export const kubeconfig = creds.kubeconfigs[0].value.apply(kc => Buffer.from(kc, "base64").toString());
Remember to replace
"YOUR_SSH_PUBLIC_KEY"
with your actual SSH public key.Next, install Helm and add the repository containing the StorageClass Helm chart:
# Install Helm curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash # Add the helm repository that contains the StorageClass chart helm repo add [REPO_NAME] [REPO_URL] # Update your repositories helm repo update
Replace
[REPO_NAME]
and[REPO_URL]
with the name and URL of the repository containing the StorageClass chart.Finally, deploy the StorageClass Helm chart to your AKS cluster:
# Install the StorageClass chart helm install [RELEASE_NAME] [REPO_NAME]/[CHART_NAME]
Replace
[RELEASE_NAME]
with a name for your deployment, and[CHART_NAME]
with the name of the StorageClass chart in the repository.This Pulumi program will create a new AKS cluster ready for Helm deployments. Once the Helm installation is complete and the chart repository is added, the StorageClass chart can be deployed using Helm into the AKS cluster, making it possible for your Kubernetes pods to utilize dynamically provisioned storage.