1. Deploy the logdna-agent helm chart on AWS EKS

    TypeScript

    To deploy the logdna-agent Helm chart on an AWS EKS cluster using Pulumi, you'll follow these steps:

    1. Set up an EKS cluster.
    2. Deploy the logdna-agent Helm chart to the cluster.

    For step 1, we'll use the high-level EKS component eks.Cluster provided by Pulumi's EKS package to create the cluster. This component simplifies the process of setting up an EKS cluster.

    For step 2, we utilize the kubernetes.helm.v3.Chart resource from the Kubernetes package which enables us to deploy Helm charts to our EKS cluster.

    Here's a detailed TypeScript program that shows how to accomplish these tasks:

    import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS cluster. // The eks.Cluster class creates an EKS cluster and deploys the necessary infrastructure in AWS. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, // Specify the desired number of worker nodes in the EKS cluster minSize: 1, // Minimum number of worker nodes the cluster can scale down to maxSize: 3, // Maximum number of worker nodes the cluster can scale up to instanceType: "t2.medium", // AWS EC2 instance type for EKS worker nodes }); // Export the cluster's kubeconfig. // The kubeconfig is necessary to interact with the EKS cluster using kubectl or any Kubernetes SDK, including Pulumi. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the logdna-agent Helm chart // The `kubernetes.helm.v3.Chart` resource allows us to deploy a Helm chart to the Kubernetes cluster. const logdnaAgentChart = new k8s.helm.v3.Chart("logdna-agent", { chart: "logdna-agent", // The name of the Helm chart version: "3.3.4", // Specify the version of the Helm chart (optional) fetchOpts: { repo: "https://assets.logdna.com/charts", // The Helm chart repository URL }, namespace: "logdna-agent", // Specify the Kubernetes namespace to deploy the Helm chart into }, { provider: cluster.provider }); // Associate the Helm chart with the EKS cluster provider // To deploy this program with Pulumi: // 1. Ensure AWS and Pulumi CLIs are installed and configured. // 2. Save this code in a file with a `.ts` extension. // 3. Run `pulumi up` in the same directory as your file. // After deployment, you can interact with your EKS cluster using kubectl by setting the kubeconfig: // $ pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml // $ KUBECONFIG=./kubeconfig.yaml kubectl get pods --namespace logdna-agent

    This program does the following:

    • Defines an EKS cluster with a given node size and count.
    • Exports the kubeconfig to enable interaction with the cluster outside of Pulumi.
    • Deploys the logdna-agent Helm chart to the EKS cluster in a specific namespace.

    To use this program:

    • Save the code in a file with a .ts extension.
    • Run pulumi up in the directory containing your file to create the EKS cluster and deploy the Helm chart.

    Remember, before running pulumi up, ensure that you have:

    • An AWS account with the appropriate permissions to create an EKS cluster and related resources.
    • The AWS CLI installed and configured.
    • The Pulumi CLI installed.

    After deploying, you can manage the logdna-agent pods and view their status using kubectl. Use the exported kubeconfig to set up your local kubectl environment:

    pulumi stack output kubeconfig --show-secrets > kubeconfig.yaml KUBECONFIG=./kubeconfig.yaml kubectl get pods --namespace logdna-agent

    Adjust the Helm chart version and fetchOpts.repo as needed based on the availability of the logdna-agent Helm chart at the time of deployment.