1. Deploy the shortlink-notify helm chart on AWS EKS


    To deploy a Helm chart on an AWS EKS cluster, we must:

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

    We'll be using Pulumi with TypeScript to define our cloud resources. Our Pulumi program will leverage the @pulumi/eks and @pulumi/kubernetes packages. The @pulumi/eks package provides resources to manage EKS clusters, making it easy to stand up an EKS cluster. The @pulumi/kubernetes package allows us to interact with Kubernetes, including deploying Helm charts.

    Creating an EKS Cluster

    First, we will create an EKS cluster by instantiating an eks.Cluster resource. We'll provide it a name and, optionally, other parameters like the desired Kubernetes version. For this basic setup, we'll use default options.

    Deploying a Helm Chart

    After creating the EKS cluster, we'll use kubernetes.helm.v3.Chart to deploy the shortlink-notify chart. You'll need to specify the repository where your Helm chart is stored or the local path if the chart is stored locally.

    Here is the Pulumi TypeScript program detailing 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("shortlink-cluster", { // We can specify additional options here: // version: "1.21", // specify the exact Kubernetes version // instanceType: "t2.medium", // specify the instance type for worker nodes // desiredCapacity: 2, // specify the desired number of worker nodes }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Once the cluster is created, we can deploy the Helm chart to it. // For this example, we're assuming that `shortlink-notify` is a helm chart // available in a public repository. const helmChart = new k8s.helm.v3.Chart("shortlink-notify-chart", { chart: "shortlink-notify", // Uncomment and replace `<repo>` with the specific helm repository if the chart is not local // repo: "<repo>", // If needed, you can specify certain values to override chart defaults. // values: { // key: "value", // }, namespace: "default", }, { provider: cluster.provider, // This ensures that the Helm chart is installed in the EKS cluster }); // The program above will create an EKS cluster and use Helm to deploy the `shortlink-notify` chart onto the cluster.

    Understanding the Resources Used

    • eks.Cluster: This is the EKS cluster resource that defines the configuration for an AWS EKS cluster, including the Kubernetes version and node types.
    • k8s.helm.v3.Chart: This resource represents a Helm chart and allows you to deploy applications managed by Helm into the Kubernetes cluster.

    The kubeconfig export at the end of the program is important because it outputs the configuration needed to connect to your Kubernetes cluster using kubectl or other Kubernetes tooling.

    After deploying this Pulumi program, you should have a running EKS cluster with the shortlink-notify Helm chart deployed.

    Running the Program

    1. Save the above code to a file named index.ts.
    2. Run pulumi up to create the resources. You'll be prompted to review and confirm the deployment.
    3. Once the deployment is successful, the output will include the kubeconfig.
    4. Use this kubeconfig to interact with your EKS cluster using kubectl.

    This is a basic setup. In practice, you might need to customize your Helm chart further, add VPC configurations, IAM roles, or consider using the AWS Load Balancer Controller for ingress. The Pulumi EKS module provides a full set of options that you can use to fine-tune your cluster resource.