1. Deploy the newrelic-infrastructure helm chart on Digital Ocean Kubernetes Service

    TypeScript

    To deploy the New Relic Infrastructure Helm chart on a Digital Ocean Kubernetes Service, you'll need to perform two main tasks:

    1. Create a Kubernetes cluster on Digital Ocean.
    2. Deploy the New Relic Infrastructure Helm chart onto the cluster.

    We will use Pulumi's digitalocean and kubernetes packages to accomplish these tasks. The steps we will follow in the Pulumi TypeScript program are:

    • Initialize a new Pulumi project and import required packages.
    • Create a new Digital Ocean Kubernetes cluster.
    • Configure Kubernetes provider to deploy resources to the new cluster.
    • Deploy the New Relic Infrastructure Helm chart using the Helm package.

    Below is the TypeScript program that defines the needed resources:

    import * as digitalocean from "@pulumi/digitalocean"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create a new DigitalOcean Kubernetes cluster. const cluster = new digitalocean.KubernetesCluster("do-cluster", { region: "nyc3", version: "latest", nodePool: { name: "default-pool", size: "s-1vcpu-2gb", nodeCount: 2, }, }); // Step 2: Use the kubeconfig from DigitalOcean to configure our Kubernetes provider. const k8sProvider = new k8s.Provider("do-k8s", { kubeconfig: cluster.kubeConfigs[0].rawConfig, }); // Step 3: Deploy the New Relic Infrastructure Helm chart. const newRelicChart = new k8s.helm.v3.Chart("newrelic-infrastructure", { chart: "newrelic-infrastructure", version: "2.4.0", // specify the chart version you want to deploy namespace: "default", fetchOpts: { repo: "https://helm-charts.newrelic.com/", }, // Values from the New Relic chart's `values.yaml` may be provided here. values: { // For example, enable certain features or provide necessary config: newrelic: { licenseKey: "<YOUR_NEW_RELIC_LICENSE_KEY>", enableKubeEvents: true, }, // Other values can be defined here as needed. }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig and the New Relic chart status. export const kubeconfig = cluster.kubeConfigs[0].rawConfig; export const chartStatus = newRelicChart.status;

    Here's what each part of the program does:

    • We import the necessary Pulumi modules for DigitalOcean and Kubernetes.
    • We define a Kubernetes cluster using the digitalocean.KubernetesCluster resource, specifying the region, Kubernetes version, and details about the node pool such as size and count.
    • Next, we use the generated kubeconfig of our new cluster to set up a Pulumi Kubernetes provider. This allows us to deploy Kubernetes resources onto our cluster.
    • We then define the New Relic Infrastructure Helm chart using a k8s.helm.v3.Chart resource. We specify the chart's name, version, and the repository URL where it can be found. We also provide the necessary configuration values that the Helm chart requires to run, which in this particular example include the New Relic license key and whether to enable Kube events recording.
    • Finally, we export the kubeconfig for direct access to the cluster using kubectl and the status of the New Relic chart so you can check if it was deployed successfully.

    In this program, replace <YOUR_NEW_RELIC_LICENSE_KEY> with your actual New Relic license key.

    To apply this Pulumi program:

    1. Save the code to a file named index.ts.
    2. Run pulumi up from the command line within the directory that contains your Pulumi program. The CLI will display a preview of the resources that will be created and prompt you for confirmation before proceeding.
    3. Confirm the preview by selecting yes. Pulumi will then begin creating the resources in the correct order, and output the exported variables upon completion.

    Make sure you've installed Pulumi CLI, configured your DigitalOcean token, and have New Relic set up beforehand.