1. Deploy the argo-app-manager helm chart on AWS EKS


    To deploy the Argo CD application on an AWS EKS cluster using the argo-app-manager Helm chart, we need to perform these high-level steps:

    1. Set up an EKS cluster: This involves creating an EKS cluster and its necessary configurations such as VPC, IAM roles, and security settings.

    2. Deploy Helm chart to the EKS cluster: Once we have the cluster, we can deploy the argo-app-manager Helm chart on it.

    We will use Pulumi's eks package for a simplified interface to create an EKS cluster alongside the kubernetes package to deploy the Helm chart. Let's begin with setting up the cluster, and then we'll proceed with deploying the chart.

    Below is a TypeScript program that performs these steps:

    import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, storageClasses: "gp2", deployDashboard: false, }); // Export the clusters' kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a k8s provider instance using the generated kubeconfig. const k8sProvider = new k8s.Provider("k8s-provider", { kubeconfig: kubeconfig.apply(JSON.stringify), }); // Deploy the argo-app-manager helm chart. const argoAppManager = new k8s.helm.v3.Chart("argo-app-manager", { chart: "argo-cd", version: "3.2.3", // Specify the version of the chart you wish to deploy. fetchOpts: { repo: "https://argoproj.github.io/argo-helm", // URL to the chart's repository. }, namespace: "argo-cd", // Recommended namespace but it can be changed. }, { provider: k8sProvider }); // Export the Helm chart name and status export const argoAppManagerName = argoAppManager.metadata.name; export const argoAppManagerStatus = argoAppManager.status;

    In this TypeScript program, I've written a Pulumi script that defines the following:

    1. EKS Cluster: We establish an EKS cluster suited for general purposes using eks.Cluster. This manages details like the desired capacity of EC2 instances and which instance type you want to use. Replace t2.medium with a different EC2 instance type based on your workload requirements.

    2. Kubeconfig: We export the kubeconfig file for the cluster, which allows us to interact with our cluster via kubectl and other Kubernetes tools.

    3. Kubernetes Provider: We set up a Kubernetes provider with the kubeconfig. This tells Pulumi how to communicate with the EKS cluster.

    4. Argo CD Helm Chart: We deploy the argo-app-manager which refers to the Argo CD Helm chart available at the specified repository. The chart is deployed in the argo-cd namespace. You'll need to ensure that the version 3.2.3 is up to date or specify a different version that you wish to deploy.

    5. Exports: The program exports the name and status of the Helm chart deployment for further reference.

    After writing this script, you can use the Pulumi CLI to deploy these resources:

    1. Run pulumi up to preview and deploy the changes.
    2. After deployment, use the exported kubeconfig to set your local KUBECONFIG environment variable or switch contexts to interact with your new EKS cluster.
    3. Check the status of your Argo CD deployment with kubectl using the provided Argo CD Helm chart name from the exports.

    Always ensure that you have the necessary permissions set up in your AWS account to create EKS clusters and manage related resources. Also, as this script will provision cloud resources, there might be costs associated with AWS EKS and the EC2 instances it provisions.