1. Deploy the elasticsearch-kb helm chart on AWS EKS


    To deploy the Elasticsearch-Kibana (elasticsearch-kb) Helm chart on AWS Elastic Kubernetes Service (EKS), we'll go through the process step by step. You will be creating an EKS cluster and then deploying the helm chart to the cluster.

    First, ensure you have Pulumi installed and configured to interact with your AWS account. You'll also need kubectl and the AWS command-line tools available to interact with your cluster.

    Here's how you can do it in Pulumi using TypeScript:

    1. Create an EKS Cluster: You will begin by creating an EKS cluster where your applications will run.

    2. Install and Configure Helm: Once the cluster is up, you will need to install Helm, a package manager for Kubernetes that allows you to manage applications' deployment.

    3. Deploy the Elasticsearch-Kibana Helm Chart: After setting up Helm, you will deploy the elasticsearch-kb Helm chart to your cluster.

    Let's start with the code to create an EKS cluster.

    import * as eks from "@pulumi/eks"; import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster const cluster = new eks.Cluster("eks-cluster", { // Specify the desired number of cluster nodes desiredCapacity: 2, minSize: 1, maxSize: 2, // Optionally specify the Kubernetes version, default is latest stable version: "1.21", // Other options can be set according to your requirements. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig;

    Learn more about creating an EKS Cluster in Pulumi

    Next, we'll set up Helm and deploy the Elasticsearch-Kibana Helm chart on our newly created cluster.

    // Create a Kubernetes provider instance that uses our EKS cluster's kubeconfig const provider = new k8s.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Elasticsearch-Kibana Helm chart const elasticsearchHelmChart = new k8s.helm.v3.Chart("elasticsearch-kb", { chart: "elasticsearch", version: "<VERSION>", // Specify the version of the Helm chart you want to deploy fetchOpts:{ repo: "https://helm.elastic.co", // Official Elastic Helm repo }, // You can define values to override the chart values here, such as: // values: { // "cluster.name": "pulumi-elastic-cluster", // // ... other values // }, }, { provider }); // Ensure that the Helm chart is installed onto our cluster by making the Helm chart // a dependent of the cluster resources. ({ dependsOn: [cluster] }); // Export the Helm chart resources export const helmChartResources = elasticsearchHelmChart.resources;

    Learn more about using Helm Charts in Pulumi

    This code sets up an EKS cluster and deploys Elasticsearch to it. Here's a breakdown of what each part does:

    • EKS Cluster: By instantiating eks.Cluster, you create a new managed Kubernetes cluster in AWS EKS. You specify the number of worker nodes and the version of Kubernetes to use.

    • Kubernetes Provider: k8s.Provider is responsible for connecting the Kubernetes API with our program, which allows us to deploy resources to the EKS cluster we’ve created.

    • Helm Chart: By creating a new instance of k8s.helm.v3.Chart with chart: "elasticsearch" and the desired Helm chart version, you tell Pulumi to use the official Elasticsearch chart from Elastic's Helm repo. You can customize the deployment further with your configurations using the values property.

    Remember to replace <VERSION> with the actual version of the Helm chart you intend to use.

    After this Pulumi program is executed:

    1. You will have an EKS cluster running.
    2. Helm will be set up in your cluster.
    3. The Elasticsearch-Kibana helm chart will be deployed in your cluster.

    To run this Pulumi program, save the TypeScript code into a file index.ts, then execute it by running pulumi up in the terminal from the same directory as the file. Make sure you've already set up your AWS credentials and installed Pulumi CLI.