Deploy the ibm-voice-gateway-dev helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the
ibm-voice-gateway-dev
Helm chart on Azure Kubernetes Service (AKS), you’ll need to follow these steps:- Set up an AKS cluster where your Helm chart will be deployed.
- Install the Helm chart onto the AKS cluster.
Pulumi allows us to manage these operations as Infrastructure as Code, codifying the setup in a way that is repeatable and version-controllable.
We'll start by creating an AKS cluster using Pulumi's
azure-native
provider, which allows us to work directly with Azure resources.Initiate Pulumi Program
You should have Pulumi and the required cloud provider CLI setup on your system. For Azure, you need to be authenticated through the Azure CLI (
az login
) and have your desired subscription set.First, we're going to create a new Pulumi project. Run the following commands in your terminal:
pulumi new typescript -y
The
-y
flag defaults toyes
on all prompts, generating a Pulumi project with TypeScript as the language of choice.After your Pulumi project scaffolding is set up, you will have a
index.ts
file where we will define our infrastructure.Create an AKS Cluster
You will now begin coding in the
index.ts
file. Define the necessary variables such as region, resource group, and AKS configurations at the beginning of your program.Here's how you'd create an AKS cluster using Pulumi:
import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure"; import * as azuread from "@pulumi/azuread"; import * as kubernetes from "@pulumi/kubernetes"; import * as azureNative from "@pulumi/azure-native"; // Create a new resource group const resourceGroup = new azure.core.ResourceGroup("my-resource-group", { location: "EastUS", }); // 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, value: "<desired-strong-password>", endDate: "2099-01-01T00:00:00Z", }); // Create the AKS cluster. const aksCluster = new azure.containerservice.KubernetesCluster("aksCluster", { resourceGroupName: resourceGroup.name, defaultNodePool: { name: "type1", nodeCount: 1, vmSize: "Standard_D2_v2", }, dnsPrefix: pulumi.interpolate`${pulumi.getStack()}-kube`, linuxProfile: { adminUsername: "adminuser", sshKey: { keyData: "<SSH-RSA PUBLIC KEY>", }, }, servicePrincipal: { clientId: adApp.applicationId, clientSecret: adSpPassword.value, }, kubernetesVersion: "1.21.1", }, { dependsOn: [adApp, adSpPassword] }); // Export the kubeconfig. export const kubeconfig = aksCluster.kubeConfigRaw;
Replace
"<desired-strong-password>"
with a strong password and"<SSH-RSA PUBLIC KEY>"
with your public SSH key.The
kubeConfigRaw
export allows you to interact with your Kubernetes cluster usingkubectl
by setting the KUBECONFIG environment variable to the output ofpulumi stack output kubeconfig
.Installing the Helm Chart
Once the AKS cluster is ready, you can deploy the
ibm-voice-gateway-dev
Helm chart to it using Pulumi'skubernetes
provider which allows you to manage Kubernetes resources, including Helm charts:// Deploy a Helm Chart into our AKS cluster. const chart = new kubernetes.helm.v3.Chart("ibm-voice-gateway-dev", { chart: "ibm-voice-gateway-dev", version: "1.0.0", // specify the version of the chart you want to deploy fetchArgs: { repo: "https://charts.your-repo.com/", // specify the Helm chart repository }, }, { provider: new kubernetes.Provider("k8s-provider", { kubeconfig: aksCluster.kubeConfigRaw }) });
You will need to substitute the
chart
,version
, andrepo
fields with the correct information for theibm-voice-gateway-dev
Helm chart.This
Chart
resource indicates that Pulumi should install the specified Helm chart into our AKS cluster using the provided kubeconfig.Running the Pulumi Program
Once the above code block is fully defined in your
index.ts
file, you can deploy your Pulumi stack with the following command:pulumi up
This will show you the preview of the resources that Pulumi plans to create. After reviewing the resources, confirm the deployment by selecting
yes
.Once the deployment is complete, you should have the
ibm-voice-gateway-dev
Helm chart running on an AKS cluster managed by Azure.Remember, before running
pulumi up
ensure you have authenticated with Azure using theaz login
and have selected the appropriate subscription.Lastly, don't forget to replace placeholder strings with the actual secrets and configuration values relevant to your environment, and be careful with handling of secrets and credentials. Use Pulumi's Secrets feature for proper management of secrets.