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

    TypeScript

    To deploy the castai-agent Helm chart on AWS EKS with Pulumi, you will be creating an EKS cluster first and then deploying the Helm chart to this cluster.

    Here's a step-by-step guide with a program written in TypeScript to perform this task.

    Step 1: Create an EKS Cluster

    Before deploying any application, you'll need an EKS cluster to which your application will be deployed. Pulumi allows creation of an EKS cluster using higher-level abstractions provided by the eks package.

    The eks.Cluster resource will create an EKS cluster with all necessary components like the VPC, IAM roles, and security groups. Additionally, you'll specify the node group configuration that dictates the size, type, and other properties of nodes that will be added to your cluster.

    Step 2: Deploying the Helm Chart

    After setting up the EKS cluster, you'll use the kubernetes.helm.v3.Chart resource from the Pulumi Kubernetes provider. This resource accepts various arguments including repository information, chart name, and values for customizing the Helm chart deployment.

    Keep in mind that you have to setup the Kubernetes provider with the kubeconfig generated from the EKS cluster to be able to manage resources in the EKS cluster.

    Let's move on to the actual Pulumi program to deploy the castai-agent Helm chart.

    import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Creating an EKS Cluster const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, minSize: 1, maxSize: 2, instanceType: "t2.medium", // Other parameters as needed }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Setting up a Kubernetes provider to interact with the EKS cluster. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Step 3: Deploying the castai-agent Helm chart const chart = new k8s.helm.v3.Chart("castai-agent", { chart: "castai-agent", version: "x.y.z", // specify the version of the chart you want to deploy fetchOpts: { repo: "https://<helm-chart-repository>", // replace with the actual Helm chart repository for castai-agent }, }, { provider: k8sProvider }); // You can add additional code to manage other resources as needed.

    In this program:

    • We create an EKS cluster named my-cluster with desired nodes and instance types. Adjust the parameters such as desiredCapacity, minSize, maxSize, and instanceType as per your requirements.
    • We then create a Kubernetes provider, specifying that we want to interact with our newly created EKS cluster. The provider requires kubeconfig, which we obtain from the cluster object.
    • Finally, we deploy the castai-agent Helm chart using the k8s.helm.v3.Chart resource. You'll need to specify the version and repository URL for the castai-agent Helm chart.

    Important to Note:

    • Replace "x.y.z" with the actual version of the castai-agent Helm chart.
    • Update the repo field with the exact repository URL for the castai-agent Helm chart.
    • Ensure that AWS credentials are correctly configured, and that the Pulumi CLI is authenticated with AWS and set up to manage resources in your account.

    Once you deploy this Pulumi program with pulumi up, it will provision the EKS cluster and deploy the castai-agent Helm chart within the cluster. You can then interact with your Kubernetes workloads running on AWS EKS.