1. Deploy the litmus-core helm chart on AWS EKS

    TypeScript

    To deploy the litmus-core helm chart on an AWS EKS cluster using Pulumi, you'll need to perform a few high-level steps:

    1. Set up an EKS cluster: You'll need a running EKS cluster to deploy your helm charts. Pulumi provides an EKS component resource which simplifies creating and configuring an EKS cluster.

    2. Deploy the Helm chart: Once you have your EKS cluster up and running, you can use Pulumi's Helm chart resource to deploy litmus-core onto the cluster.

    Let's dive into the code. Make sure you have Pulumi installed and configured with your AWS account credentials before running the below program.

    import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster const cluster = new eks.Cluster("litmus-cluster", { // Specify the desired settings for the EKS cluster (instance size, node count, etc.) instanceType: "t2.medium", desiredCapacity: 2, // Minimum recommended size for Litmus minSize: 1, maxSize: 3, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses the EKS cluster's kubeconfig. const provider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the litmus-core Helm chart to the EKS cluster const litmusCoreChart = new k8s.helm.v3.Chart("litmus-core", { chart: "litmus", version: "<chart version>", // Specify the version of the litmus-core chart you want to deploy fetchOpts: { repo: "https://litmuschaos.github.io/litmus-helm/", // The repository where the litmus-core chart is hosted }, // You can specify additional Helm values here if necessary }, { provider: provider }); // Export the cluster's name and kubeconfig export const clusterName = cluster.eksCluster.name;

    This program does the following:

    • It imports the necessary Pulumi packages.
    • It declares a new EKS cluster with the name litmus-cluster and sets some basic configuration including the desired node size and count.
    • It exports the kubeconfig of the EKS cluster which is required to communicate with your cluster.
    • It sets up a K8s provider which is important to interact with the Kubernetes API of your EKS cluster.
    • It deploys the litmus-core Helm chart from the litmuschaos Helm repository to your EKS cluster using the created K8s provider.

    Before running this program, you need to install @pulumi/eks and @pulumi/kubernetes packages using npm if you haven't done that already:

    npm install @pulumi/eks @pulumi/kubernetes

    To run this Pulumi program, you would navigate to the directory containing the index.ts file (this typescript program) and use the Pulumi CLI:

    pulumi up

    This will prompt Pulumi to start creating the resources as defined in the program. The CLI will display the progress and any messages regarding the deployment steps.

    Please ensure you've selected the right Helm chart version for litmus-core. If unsure, you can look it up at the helm chart's repository mentioned in the program.

    Remember, running the pulumi up command may result in AWS charges for the resources created, so make sure to clean up resources with pulumi destroy if they are no longer needed to avoid ongoing charges.