1. Deploy the workshop-exercise helm chart on AWS EKS

    TypeScript

    To deploy a Helm chart on AWS EKS using Pulumi, we'll need to perform the following steps:

    1. Create an EKS cluster on AWS.
    2. Deploy the Helm chart to the EKS cluster.

    For step 1, we will use the eks package to create an Amazon EKS cluster. The eks.Cluster class will be used to set up the EKS cluster with the desired configuration, such as the number of nodes, node size, and Kubernetes version.

    For step 2, we use the kubernetes.helm.sh/v3.Chart class from the kubernetes package to deploy a Helm chart. The Chart resource allows us to specify the Helm chart we wish to deploy, its version, along with any custom values that the chart accepts.

    In the program below, we start by creating an EKS cluster. Once the cluster is up and running, we deploy the workshop-exercise Helm chart to the Kubernetes cluster managed by EKS. This Helm chart is a placeholder for your actual chart, and you'll need to replace REPO_URL and CHART_NAME with the URL of your Helm chart's repository and the chart name, respectively. If your chart is part of the stable repository or any other repository that's added by default in Helm, you can omit the repo attribute.

    Please ensure you have Pulumi CLI installed and configured with AWS credentials before running this program. You also need to have kubectl installed to interact with the cluster post-deployment.

    Here is the TypeScript program to accomplish the task:

    import * as pulumi from '@pulumi/pulumi'; import * as eks from '@pulumi/eks'; import * as k8s from '@pulumi/kubernetes'; // Create an EKS cluster. const cluster = new eks.Cluster('workshop-eks-cluster', { instanceType: 't2.medium', desiredCapacity: 2, minSize: 1, maxSize: 2, deployDashboard: false, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our cluster from above. const k8sProvider = new k8s.Provider('k8s-provider', { kubeconfig: cluster.kubeconfig, }); // Deploy the workshop-exercise Helm chart to the EKS cluster. const helmChart = new k8s.helm.v3.Chart('workshop-exercise-chart', { chart: 'CHART_NAME', version: 'CHART_VERSION', // specify the chart version fetchOpts: { repo: 'REPO_URL', // specify the repository URL }, }, { provider: k8sProvider }); // Optional: Export the Helm chart's resource names. export const helmResources = helmChart.getResourceNames();

    This Pulumi program initializes an EKS cluster with 2 t2.medium instances and sets the minimum and maximum size of the cluster. The Dashboard deployment is disabled as it's not recommended for a production environment.

    After the cluster is created, the program exports the kubeconfig which you can use with kubectl to interact with the cluster. Then, it defines a Kubernetes provider to deploy resources to this EKS cluster.

    Lastly, the program deploys the workshop-exercise Helm chart using the Kubernetes provider. We didn't provide actual REPO_URL or CHART_NAME, as these are pseudo placeholders. Make sure to replace them with the actual details of your Helm chart repository.

    You can also export additional information from your Helm chart by querying the helmChart resource. For example, the above program exports the names of resources created by the Helm chart.

    To run the program, you would save the code to a file named index.ts, then run pulumi up to execute the deployment. The Pulumi CLI will prompt you to review the changes and confirm the deployment, and upon confirmation, the resources will be provisioned in your AWS account.