1. Deploy the datadog-apm helm chart on AWS EKS


    Deploying a Helm chart on Amazon EKS using Pulumi requires a series of steps. We'll break down the process into creating an EKS cluster and then deploying the Datadog APM Helm chart to it. We'll be using the @pulumi/awsx and @pulumi/kubernetes Node.js packages for creating EKS clusters and manipulating Kubernetes resources, respectively.

    Step 1: Define the Amazon EKS Cluster

    Pulumi's awsx package makes it very easy to set up an EKS cluster. We'll define the cluster along with the required VPC and IAM roles. An EKS cluster contains one or more managed worker nodes that run containerized applications.

    Step 2: Deploy the Datadog APM Helm Chart

    Once the EKS cluster is available, we can proceed to deploy the Datadog APM Helm chart to the Kubernetes cluster managed by EKS.

    Helm charts offer a way to streamline installing and managing Kubernetes applications. You would typically run helm install to install a chart, but with Pulumi, you can declaratively manage the installation as part of your infrastructure.

    Below is the Pulumi TypeScript program that accomplishes the deployment of the Datadog APM Helm chart on AWS EKS.

    Make sure you have the Pulumi CLI installed and your AWS credentials are configured.

    import * as awsx from "@pulumi/awsx"; import * as k8s from "@pulumi/kubernetes"; import * as pulumi from "@pulumi/pulumi"; // Step 1: Create an EKS cluster. const cluster = new awsx.eks.Cluster("datadog-eks-cluster", { desiredCapacity: 2, // Define how many worker nodes you want minSize: 1, // Set the minimal number of instances the cluster can scale down to maxSize: 3, // Set the maximum number of instances for the cluster // The default instance type is suitable for most workloads, change if needed. }); // Export the cluster's kubeconfig to enable connecting to the cluster. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the Datadog APM Helm chart. const datadogChart = new k8s.helm.v3.Chart("datadog-apm", { chart: "datadog", // The name of the chart from the Helm repository. version: "2.21.5", // Specify the version of the chart you wish to deploy. fetchOpts: { repo: "https://helm.datadoghq.com", // The Datadog helm chart repository. }, values: { datadog: { apm: { // Enable APM and specify any additional chart values here. enabled: true, }, }, }, }, { provider: cluster.provider }); // Ensure that Helm uses the correct Kubernetes provider for EKS. // Once the program runs, you can interact with your EKS cluster using kubectl and the exported kubeconfig.

    In this code:

    • We are defining an EKS cluster with a desired capacity of worker nodes.
    • We are deploying the Datadog APM Helm chart with APM enabled by setting the datadog.apm.enabled value.

    To execute the program, save the code to a .ts file and set up your Pulumi project with the appropriate stack:

    pulumi stack init dev pulumi up

    Once the program completes, the EKS cluster will be up and running with the Datadog APM agent ready. You can interact with your new cluster using the kubectl CLI:

    pulumi stack output kubeconfig > kubeconfig.yaml export KUBECONFIG=$PWD/kubeconfig.yaml kubectl get nodes

    This will authenticate kubectl with your new cluster and show you its worker nodes. You should also see the Datadog agent running as part of your cluster's resources.

    Keep in mind that using the Helm chart this way assumes some default Datadog configurations, which you might need to tailor to your use case. For more complex settings, the values object in the Helm chart definition allows you to specify the same configurations you would in a values.yaml file, directly within your Pulumi program.