Deploy the ibm-websphere-liberty helm chart on Azure Kubernetes Service (AKS)
TypeScriptTo deploy the IBM WebSphere Liberty Helm chart on Azure Kubernetes Service (AKS), we will take the following steps with Pulumi:
- Set up an AKS cluster on Azure.
- Install the Helm chart for IBM WebSphere Liberty onto the AKS cluster.
We will use the Pulumi Azure Native provider to create an AKS cluster. Once the cluster is up, we will interact with the Kubernetes API running in Azure to deploy IBM WebSphere Liberty via its Helm chart.
First, let’s create an AKS cluster. We will define necessary resources such as the node size, the number of nodes, and so on.
Below is a Pulumi program written in TypeScript that sets up an AKS cluster. Some values like resource group or location may need to be adjusted according to your Azure subscription and requirements.
After creating the AKS cluster, we will use the
kubernetes.helm.sh/v3.Chart
resource from Pulumi Kubernetes provider to deploy the Helm chart. This is an abstraction to deploy a chart from a Helm repository or a local chart.Please make sure you have Pulumi installed and configured with the appropriate Azure credentials before running this program. You will also need to have the
@pulumi/azure-native
and@pulumi/kubernetes
packages installed.Now, let’s write the Pulumi program:
import * as azure from "@pulumi/azure-native"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Create an Azure Resource Group const resourceGroup = new azure.resources.ResourceGroup("aksResourceGroup"); // Create an AKS cluster const cluster = new azure.containerservice.ManagedCluster("aksCluster", { resourceGroupName: resourceGroup.name, kubernetesVersion: "1.19.11", identity: { type: "SystemAssigned", }, agentPoolProfiles: [{ name: "agentpool", count: 2, vmSize: "Standard_DS2_v2", mode: "System", osType: "Linux", }], dnsPrefix: "aksk8s", }); // Export the kubeconfig export const kubeConfig = cluster.kubeConfig; // Step 2: Deploy IBM WebSphere Liberty Helm Chart on the AKS cluster const aksKubeConfig = pulumi.all([cluster.name, resourceGroup.name]).apply(([clusterName, rgName]) => { const command = `az aks get-credentials --name ${clusterName} --resource-group ${rgName} --file -`; let data = ''; const options = { stdio: [ 'pipe', // StdIn 'pipe', // StdOut 'ignore', // StdErr (We don't want to handle StdErr in this example) ], }; const proc = require('child_process').spawn('az', command.split(' '), options); proc.stdout.on('data', chunk => data += chunk); return new Promise<string>((resolve, reject) => { proc.on('close', _ => resolve(data)); }); }); // Ensure that the AKS cluster is ready before attempting to deploy a Helm Chart into it const helmChart = new k8s.helm.v3.Chart("ibm-websphere-liberty", { chart: "ibm-websphere-liberty", version: "3.2.3", // Specify the version of the Helm chart you wish to deploy fetchOpts: { repo: "https://charts.bitnami.com/bitnami", // Specify the Helm chart repository }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: aksKubeConfig }) }); // Export the public address of the IBM WebSphere Liberty service export const ibmWebsphereLibertyServiceIP = helmChart.getResourceProperty("v1/Service", "ibm-websphere-liberty", "status").apply(status => status.loadBalancer.ingress[0].ip);
In this program:
- We define an AKS cluster with a specified VM size and node count. Modify these as necessary for your workload.
- We define a Helm chart deployment for IBM WebSphere Liberty. Make sure that the version and repository for the Helm chart are correct. The
fetchOpts
property tells Pulumi where to find the Helm chart if it’s not in the default Helm repo. - We export the kubeconfig so you can interact with the cluster via kubectl if necessary. Always be careful with kubeconfig files as they grant cluster access.
- We export the service IP address where IBM WebSphere Liberty will be publicly accessible once deployed. This address can be used in a web browser to access your IBM WebSphere Liberty instance.
Please adjust configuration values like the AKS version, chart version, and others to match your specific needs. Refer to the charts' official documentation for the specific values required.
Finally, when you run this Pulumi program with
pulumi up
, Pulumi will reach out to Azure to provision these resources and configure the Kubernetes cluster in line with your settings. Once the AKS cluster is provisioned, the IBM WebSphere Liberty Helm chart will be deployed to the Kubernetes cluster.