1. Deploy the aws-container-insight-fluent-bit helm chart on AWS EKS

    TypeScript

    To deploy the aws-container-insight-fluent-bit helm chart on AWS EKS, you will need to perform several steps:

    1. Set up an AWS EKS Cluster: To run Kubernetes workloads, you will first need to create an EKS Cluster.

    2. Deploy Helm Chart on EKS: Once you have the EKS Cluster, you can deploy Helm Charts to it. In this case, you will deploy the aws-container-insight-fluent-bit chart which is designed to provide container insights by capturing logs and metrics and sending them to Amazon CloudWatch.

    Here's how you can do this with Pulumi and TypeScript:

    Program Explanation

    • We will set up the required AWS EKS cluster using the @pulumi/eks package which provides a high-level abstraction to easily create and manage an EKS cluster.
    • After the cluster is set up, we will install the aws-container-insight-fluent-bit helm chart using the @pulumi/kubernetes package which allows us to deploy Helm charts.

    Note that before running the Pulumi code, you must have Pulumi CLI installed, AWS CLI configured with the necessary permissions to create resources, and Helm CLI installed for chart management.

    The Pulumi Program

    import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create the EKS Cluster const name = "my-eks-cluster"; // Create an EKS cluster with the default configuration. const cluster = new eks.Cluster(name, {}); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the Helm chart to EKS // Create a Kubernetes provider instance that uses our EKS cluster from above. const provider = new k8s.Provider(name, { kubeconfig: cluster.kubeconfig }); const namespace = new k8s.core.v1.Namespace("fluent-bit", { metadata: { name: "fluent-bit" } }, { provider }); const fluentBit = new k8s.helm.v3.Chart("fluent-bit", { namespace: namespace.metadata.name, chart: "aws-for-fluent-bit", version: "0.1.10", // replace with the desired chart version fetchOpts: { repo: "https://aws.github.io/eks-charts", // This is the repository where the helm chart is hosted }, }, { provider }); // Export the Fluent Bit Helm chart status export const fluentBitStatus = fluentBit.status;

    Explanation of Key Points

    • eks.Cluster: This component resource helps create and manage an EKS cluster. It abstracts away a lot of the boilerplate involved with EKS clusters.

    • k8s.Provider: This is the Kubernetes provider that enables us to interact with the cluster we just created. We specify the kubeconfig from the EKS cluster to allow Pulumi to manage resources in the cluster.

    • k8s.core.v1.Namespace: We create a Kubernetes namespace for the Fluent Bit resources. This helps in organizing and isolating the components within the cluster.

    • k8s.helm.v3.Chart: This component resource manages a Helm chart. Helm is used to deploy pre-packaged applications on Kubernetes. The fluent bit chart we're deploying is for AWS, which includes elements that will send logs to CloudWatch.

    • fluentBitStatus: We export the status of the Helm deployment to ensure that deployment of the chart was successful.

    Next Steps

    Run the Pulumi program with the below commands:

    pulumi up

    This will prompt you to confirm the actions before making changes to your cloud resources. Once confirmed, Pulumi will provision the AWS EKS cluster and deploy the aws-container-insight-fluent-bit helm chart on it.

    Remember that altering cloud resources with Pulumi incurs costs and should be done with the understanding of your AWS budget and resources. Always review the plan that pulumi up provides before confirming the action.