1. Deploy the http-echo helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy the http-echo Helm chart on Oracle Kubernetes Engine (OKE), you will perform the following steps in Pulumi:

    1. Set up an OKE Cluster: Before deploying any applications, you need an existing Kubernetes cluster on OKE. For this step, you would use oci.ContainerEngine.Cluster resource.

    2. Configure Kubernetes Provider: Once the cluster is set up, you will configure Pulumi to use the Kubernetes provider pointing to your OKE cluster, this will be automatically handled if you have your kubeconfig set up properly.

    3. Install the Helm Chart: Using the kubernetes.helm.v3.Chart resource, you can deploy your http-echo Helm chart.

    Here is how you could write this program in TypeScript. This program assumes that your OKE cluster already exists and that you have the necessary OCI and Kubernetes configurations set up.

    import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Step 1 is omitted because creating an entire OKE cluster is outside the scope of this explanation. // Make sure your OKE cluster is up and running. // Step 2: Configure Kubernetes provider to point to the OKE cluster // The provider configuration is typically handled by Pulumi based on your already set up kubeconfig. // Step 3: Deploy the `http-echo` Helm chart to your OKE cluster const httpEchoChart = new k8s.helm.v3.Chart("http-echo", { chart: "http-echo", version: "0.2.3", // Specify the version of the Helm chart here, if necessary. fetchOpts: { repo: "https://helm.repo.url", // Replace with the actual chart repository URL }, // You can specify additional Helm chart values here, as needed. values: { // Values required by the `http-echo` chart // E.g. replicaCount: 2, // For this example, we assume default values are fine. }, }); // Export the public IP address of the `http-echo` service export const httpEchoPublicIp = httpEchoChart.getResourceProperty( "v1/Service", "http-echo", "status" ).apply(status => status.loadBalancer.ingress[0].ip);

    In the code above:

    • You are importing the necessary packages from Pulumi's SDK which include both Pulumi's core functionalities and the Kubernetes package.
    • Since the creation of an OKE cluster involves various settings specific to your environment, we assume that step is already done.
    • For deploying the Helm chart, we're creating an instance of Chart, specifying the name of the chart and optionally the version and its repository.
    • values would be a JavaScript object where you'd include configuration specific to the http-echo chart. For brevity, we're not specifying any configuration and using the chart's defaults.
    • Finally, we are using the export statement to expose the public IP address of the service created by the http-echo chart. Users can access the http-echo service from their browser using this public IP.

    Please replace https://helm.repo.url with the actual Helm repository URL where the http-echo chart is located, and specify the version if needed.

    Before you can apply this Pulumi code, please ensure you have the following prerequisites taken care of:

    • You have installed the Pulumi CLI.
    • You are logged in to the Oracle Cloud Infrastructure (OCI) CLI and have the appropriate permissions.
    • You have set up the OCI and Kubernetes configuration files correctly, which Pulumi relies on to interact with your cloud resources and Kubernetes cluster.

    After ensuring these prerequisites, you can run pulumi up in your terminal within the directory of your Pulumi project to deploy the Helm chart to your OKE cluster.