1. Deploy the ibm-cp4d-watson-knowledge-catalog-instance helm chart on Azure Kubernetes Service (AKS)

    TypeScript

    To deploy the IBM Watson Knowledge Catalog instance via a Helm chart on Azure Kubernetes Service (AKS), you'll need to follow these steps:

    1. Set up AKS: Create a Kubernetes cluster in Azure using AKS.
    2. Install Helm and Tiller: Ensure Helm is installed and Tiller is securely configured in your cluster. Helm is a package manager for Kubernetes, and Tiller is its server-side component.
    3. Add IBM's Helm chart repository: Add the Helm repository that contains the IBM Watson Knowledge Catalog charts.
    4. Deploy the Helm chart: Use Helm to deploy the IBM Watson Knowledge Catalog (cp4d) instance into your AKS cluster.

    Let's break these steps down with the appropriate Pulumi code that achieves this in TypeScript:

    Step 1: Set up Azure Kubernetes Service (AKS)

    First, we'll need to create an AKS cluster, which consists of creating a resource group, a virtual network, a subnet, and then the AKS cluster itself. This example assumes that you are already authenticated with Azure through the Azure CLI and have set up the required Pulumi stack with the azure-native provider.

    import * as pulumi from "@pulumi/pulumi"; import * as azure from "@pulumi/azure"; import * as azuread from "@pulumi/azuread"; import * as azurenative from "@pulumi/azure-native"; import * as kubernetes from "@pulumi/kubernetes"; // Step 1: Create the AKS cluster using Azure Native const resourceGroupName = "myResourceGroup"; const resourceGroup = new azure.core.ResourceGroup(resourceGroupName); // 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 virtual network and a subnet const virtualNetwork = new azure.network.VirtualNetwork("vnet", { resourceGroupName: resourceGroup.name, addressSpaces: ["10.2.0.0/16"], }); const subnet = new azure.network.Subnet("subnet", { resourceGroupName: resourceGroup.name, virtualNetworkName: virtualNetwork.name, addressPrefix: "10.2.1.0/24", }); // Create the AKS cluster const managedCluster = new azure.containerservice.KubernetesCluster("aksCluster", { resourceGroupName: resourceGroup.name, linuxProfile: { adminUsername: "aksuser", sshKey: { keyData: "<YOUR_SSH_PUBLIC_KEY>" }, }, servicePrincipal: { clientId: adApp.applicationId, clientSecret: adSpPassword.value, }, defaultNodePool: { name: "aksagentpool", nodeCount: 3, vmSize: "Standard_DS2_v2", osDiskSizeGb: 30, vnetSubnetId: subnet.id, }, dnsPrefix: "myakscluster", // Enable RBAC roleBasedAccessControl: { enabled: true }, }); // Export the kubeconfig export const kubeconfig = managedCluster.kubeConfigRaw;

    This code defines an AKS cluster with three default nodes in the default node pool using VM size Standard_DS2_v2. Make sure to replace <YOUR_SSH_PUBLIC_KEY> with your actual SSH public key. This snippet also exports the kubeconfig, which you will use to connect and interact with your AKS cluster.

    Step 2: Install Helm

    Before you proceed with this step, ensure that Helm v3 is installed on your local machine since Pulumi will use the Helm client to deploy the chart. The Helm installation process isn't handled by Pulumi itself and needs to be done ahead of time.

    Step 3 & 4: Add IBM Helm Chart Repository and Deploy the Chart

    After setting up AKS and ensuring that Helm is installed, you can proceed with adding the IBM Helm chart repository and deploying the Watson Knowledge Catalog Helm chart.

    // IBM Watson Knowledge Catalog helm chart deployment const watsonCatalogChart = new kubernetes.helm.v3.Chart("ibm-cp4d-watson-knowledge-catalog", { // Replace with the actual chart name and version chart: "ibm-cp4d-watson-knowledge-catalog", version: "1.0.0", fetchOpts:{ repo: "https://raw.githubusercontent.com/IBM/charts/master/repo/stable/" }, // You may need to provide required values according to the IBM Helm chart values: { // Provide appropriate configuration values here } }, { provider: new kubernetes.Provider("k8s-provider", { kubeconfig }) });

    Here we're defining a Helm chart resource using Pulumi's Kubernetes provider. The chart property specifies the name of the IBM chart, and version property specifies the chart version to use. You need to replace the repo URL with the actual IBM Helm chart repository if it's different. The values property should contain configuration settings specific to the IBM CP4D Watson Knowledge Catalog chart; refer to the Helm chart's documentation for what values are needed.

    To execute the above Pulumi code, you would run the following commands:

    • pulumi up to create or update the resources
    • pulumi stack export when you need to see output variables like the kubeconfig

    Remember to consult the Helm chart's documentation for Watson Knowledge Catalog to determine the right values and any prerequisite steps required before deployment.