1. Deploy the tekton-pipelines helm chart on AWS EKS


    To deploy the Tekton Pipelines Helm chart on AWS EKS using Pulumi, you'll go through several steps, including provisioning an EKS cluster and then deploying the Helm chart to the cluster.

    Step 1: Create an AWS EKS Cluster

    First, we'll create an Amazon EKS cluster. We'll use the Pulumi eks package, which provides a Cluster resource that simplifies the creation of EKS clusters. It's often preferred over the lower-level aws.eks.Cluster because it abstracts a lot of the boilerplate and manages the necessary resources for you.

    When creating an EKS cluster with Pulumi, you need to specify a few required properties like the node instance type, desired capacity, min and max size of nodes, and the AWS region.

    Step 2: Deploy the Helm Chart

    Next, you can deploy the Tekton Pipelines Helm chart into the EKS cluster. Pulumi's Kubernetes provider can be used to deploy Helm charts. You'll need to install the Kubernetes provider and configure it to use the kubeconfig file generated by the EKS cluster you just provisioned.

    Below is a TypeScript program in Pulumi that sets up an EKS cluster and deploys the Tekton Pipelines Helm chart. This code assumes that your AWS and Pulumi CLI are already configured:

    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: Provision an EKS cluster const cluster = new eks.Cluster("my-cluster", { instanceType: "t2.medium", // Specify the instance type for the nodes desiredCapacity: 2, // Specify the desired number of nodes minSize: 1, maxSize: 3, createOidcProvider: true, // Enable IAM roles for Service Accounts (IRSA) }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy Tekton Pipelines Helm chart const tektonChart = new k8s.helm.v3.Chart("tekton-pipelines", { chart: "tekton-pipelines", version: "0.27.3", // Use the version of Tekton you wish to deploy fetchOpts:{ repo: "https://tekton-releases.storage.googleapis.com", }, }, { provider: cluster.provider }); // Export the Helm chart status export const helmChartStatus = tektonChart.status;

    Breakdown of the program:

    • EKS Cluster: We create a managed EKS cluster with a specified instance type and desired number of nodes. The createOidcProvider flag is set to true, which is necessary if you want to use IAM roles for service accounts with Tekton or other cloud-native services deployed on EKS.

    • Kubeconfig: The output kubeconfig contains the information needed to authenticate to the EKS cluster.

    • Tekton Helm Chart: We deploy the Tekton Pipelines Helm chart using Pulumi's Helm chart resource. This requires specifying the name of the chart (tekton-pipelines), chart version, and the repository URL where the chart can be found.

    Note: The fetchOpts.repo is the Helm repository where the Tekton Pipelines chart is located. Make sure to use the appropriate chart version for your needs.

    How to Run This Program:

    1. Ensure you have the Pulumi CLI and AWS CLI installed.
    2. Configure your AWS profile using the AWS CLI (aws configure).
    3. Create a new folder for your Pulumi project.
    4. Run pulumi new typescript inside the folder and follow the prompts.
    5. Replace the contents of the index.ts file with the code above.
    6. Run npm install to fetch the necessary NPM modules.
    7. Run pulumi up to provision the EKS cluster and deploy the Helm chart.

    The pulumi up command will preview the changes and prompt you for confirmation before applying the changes. If everything looks correct, confirm the deployment and Pulumi will provision your resources in AWS. Once done, you will see the exported kubeconfig and helmChartStatus which you can use to interact with the Tekton Pipelines running in your EKS cluster.