1. Deploy the kubeflow-kfserving-inference helm chart on Google Kubernetes Engine (GKE)

    TypeScript

    To deploy the Kubeflow KFServing inference Helm chart on Google Kubernetes Engine (GKE), you'll first need to create a GKE cluster and then use the Pulumi kubernetes package to deploy the Helm chart to your cluster.

    Below is a program that first creates a GKE cluster and then deploys the KFServing inference Helm chart to the cluster:

    1. Google Kubernetes Engine (GKE) Cluster: We start by creating a GKE cluster using the gcp.container.Cluster resource. We give it a predefined name, and you can customize the machine type, location, and other configurations as per your requirements.

    2. Kubernetes Provider: Once the GKE cluster is ready, we create an instance of the Pulumi Kubernetes Provider pointing to the kubeconfig of the newly created GKE cluster. This provider is responsible for deploying resources to the cluster.

    3. Helm Chart: Finally, we deploy the KFServing inference Helm chart using the kubernetes.helm.v3.Chart resource. This assumes that the Helm chart is available in a public or private Helm chart repository that you have access to. The chart parameter specifies the name of the chart, while version can be used to specify a specific chart version.

    Here is the program:

    import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; // Create a GKE cluster. const cluster = new gcp.container.Cluster("my-kubeflow-cluster", { initialNodeCount: 2, minMasterVersion: "latest", nodeVersion: "latest", nodeConfig: { machineType: "n1-standard-1", oauthScopes: [ "https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only", "https://www.googleapis.com/auth/logging.write", "https://www.googleapis.com/auth/monitoring", ], }, }); // Get the Kubeconfig from the GKE cluster. const kubeconfig = pulumi. all([cluster.name, cluster.endpoint, cluster.masterAuth]). apply(([name, endpoint, masterAuth]) => { const context = `${gcp.config.project}_${gcp.config.zone}_${name}`; return `apiVersion: v1 clusters: - cluster: certificate-authority-data: ${masterAuth.clusterCaCertificate} server: https://${endpoint} name: ${context} contexts: - context: cluster: ${context} user: ${context} name: ${context} current-context: ${context} kind: Config preferences: {} users: - name: ${context} user: auth-provider: config: cmd-args: config config-helper --format=json cmd-path: gcloud expiry-key: '{.credential.token_expiry}' token-key: '{.credential.access_token}' name: gcp `; }); // Create a Kubernetes provider instance that uses our cluster from above. const k8sProvider = new k8s.Provider("my-kubeflow-provider", { kubeconfig: kubeconfig, }); // Deploy the KFServing inference Helm chart using the Kubernetes provider. const kfserving = new k8s.helm.v3.Chart("kfserving-inference", { chart: "kfserving", version: "0.6.0", // Specify the chart version you want to deploy, update this accordingly. fetchOpts: { repo: "https://kubeflow.github.io/kfserving", // Replace with the Helm repository URL where the chart is located. }, }, { provider: k8sProvider }); // Export the Kubeconfig. export const kubeconfigOutput = kubeconfig; // When running this program, Pulumi will first create the GKE cluster, // then set up the Kubernetes provider, and lastly deploy the Helm chart.

    This code will create a GKE cluster that has the necessary API scopes for GKE workloads. After the cluster is created, it sets up a Pulumi Kubernetes provider pointing to the cluster's kubeconfig. Finally, it deploys the KFServing Helm chart in the GKE cluster using the kubernetes.helm.v3.Chart resource.

    Please replace the version and repo fields for the Helm chart with correct values corresponding to the KFServing inference Helm chart you wish to deploy. You can find these details in the Helm chart repository you intend to use.

    Ensure that you have the necessary permissions and GCP credentials set up in your environment to create and manage resources in Google Cloud Platform. Additionally, Pulumi CLI should be installed and set up to work with the appropriate Pulumi account, project, and stack.

    Run this program using the Pulumi CLI by navigating to the directory containing this file and executing pulumi up. This command will prompt you to review the changes before applying them to your cloud provider.