1. Deploy the newrelic-logging helm chart on Google Kubernetes Engine (GKE)


    To deploy the New Relic Logging Helm chart on Google Kubernetes Engine (GKE) using Pulumi, you need to perform several steps. Below, I will walk you through the process.

    1. Set Up a GKE Cluster: Before you can deploy the Helm chart, you need a GKE cluster. You will define a GKE cluster resource using Pulumi.
    2. Install Helm Chart: With the cluster in place, you'll set up the Helm Release resource which points to the New Relic Logging Helm chart.

    Let's get started with the detailed code:

    import * as pulumi from "@pulumi/pulumi"; import * as gcp from "@pulumi/gcp"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create a GKE cluster const cluster = new gcp.container.Cluster("newrelic-logging-cluster", { // We're keeping these options minimal for the example, however in a real world // scenario you'd choose the appropriate configuration for your needs. initialNodeCount: 2, nodeVersion: "latest", minMasterVersion: "latest", nodeConfig: { machineType: "n1-standard-1", }, }); // Export the Kubeconfig for the 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 `; }); // Step 2: Deploy the New Relic Logging Helm chart const newrelicLoggingChart = new k8s.helm.v3.Release("newrelic-logging-chart", { chart: "newrelic-logging", // Typically, you would fetch this chart from a defined Helm repository, e.g., // `https://helm-charts.newrelic.com/` // For this example, we'll assume this repo has been added and named 'newrelic' repositoryOpts: { repo: "newrelic", }, version: "1.0.0", // Specify the version you wish to deploy namespace: "default", // Values from the values.yaml of the chart or custom ones can be added here. values: { licenseKey: "<YOUR_NEW_RELIC_LICENSE_KEY>", // Replace with your own key // Other configuration options as needed. }, }, { provider: new k8s.Provider("k8s-provider", { kubeconfig: kubeconfig }) }); // Export the Kubeconfig file so that it can be used outside of Pulumi. export const kubeconfigFile = kubeconfig;

    In this program:

    • We create a GKE cluster with a basic configuration suitable for small-scale testing. In a production environment, you would choose a configuration that matches your workload requirements, including the region or zone, machine type, and the number and types of nodes in your node pool.

    • A kubeconfig file is constructed for authenticating to this cluster via gcloud. You'd use this file for running kubectl commands against your GKE cluster.

    • We deploy the New Relic Logging Helm chart with Pulumi's Kubernetes provider, pointing at our newly created GKE cluster. We're using placeholder values for version and the New Relic license key, but you would replace these with actual values. Likewise, other configurations specific to your setup can be specified in the values property.

    With the above Pulumi program, you will have a GKE cluster with the New Relic Logging Helm chart deployed to it. Make sure to replace <YOUR_NEW_RELIC_LICENSE_KEY> with your actual New Relic license key.

    To run this Pulumi program, save the code in a .ts file, install the necessary packages using npm or yarn, and then use the pulumi up command to provision the resources. Ensure that you have Pulumi CLI installed and are authenticated with Google Cloud Platform and Pulumi.

    Please review the documentation for more details on each resource used: