Deploy the elasticsearch-legacy helm chart on AWS EKS
TypeScriptTo deploy the
elasticsearch-legacy
Helm chart on AWS EKS using Pulumi, you will first need to set up an EKS cluster. After the cluster is set up, you will then use thehelm.sh/v3.Chart
resource to deploy theelasticsearch-legacy
chart to the cluster.Below is a Pulumi program written in TypeScript that demonstrates how to accomplish this. The program does the following:
-
Set up an EKS cluster: We leverage the
eks.Cluster
resource to create an AWS Elastic Kubernetes Service (EKS) cluster. It includes all the necessary configuration like the instance type for the nodes, and whether or not you want to deploy the cluster using Fargate (which is serverless). -
Deploy the Helm chart: After the EKS cluster is ready, we use Pulumi's
kubernetes.helm.v3.Chart
resource to deploy theelasticsearch-legacy
chart from a specified Helm chart repository.
Make sure to have Pulumi installed and configured with AWS credentials. Also, you should have
kubectl
and the Helm CLI installed to interact with the cluster directly, if needed.Here's the Pulumi TypeScript program:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create an EKS Cluster // Documentation: https://www.pulumi.com/registry/packages/eks/api-docs/cluster/ const cluster = new eks.Cluster("my-cluster", { // You can specify additional options here, like instance type, region, etc. // For the purposes of this example, we're using default settings. }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the elasticsearch-legacy Helm chart on the EKS cluster // Documentation: https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/chart/ const elasticsearchLegacy = new k8s.helm.v3.Chart("elasticsearch-legacy", { // Replace `REPO_URL` with the URL of the Helm repository that contains the elasticsearch-legacy chart repo: "REPO_URL", chart: "elasticsearch-legacy", // The version number can be changed to whatever version of the chart you wish to deploy. version: "VERSION", // namespace property is optional and Helm chart will be installed in the 'default' namespace if not provided // namespace: "desired-namespace" }, { provider: cluster.provider }); // At this point, Pulumi will have applied your desired state to the cluster, and the elasticsearch-legacy service will be running. // You can interact with the service using `kubectl` with the exported kubeconfig.
Please note that you will need to replace
REPO_URL
with the actual repository URL that hosts theelasticsearch-legacy
Helm chart andVERSION
with the chart version you wish to deploy.This program sets up an EKS cluster and deploys the elasticsearch-legacy Helm chart to that cluster. Upon running
pulumi up
, Pulumi will provision the resources on AWS and deploy the chart as described. Make sure the Helm chart you're referring to is compatible with your EKS cluster's Kubernetes version.It's also worth mentioning that you need to be aware of Helm's values. Helm charts have configurable parameters that you can set through Pulumi by providing an appropriate
values
property within the Helm chart resource if necessary. For example:values: { // Configuration values for the elasticsearch-legacy chart "replicaCount": 2, // ... other chart values },
Follow the official Pulumi installation guide to set up Pulumi with AWS if you haven't already done so. After everything is set up, run the Pulumi program using the following commands:
pulumi stack init dev # Initializes a new Pulumi stack pulumi up # Preview and deploy changes
Monitor the output in your terminal for any errors during the deployment and address them as needed. Once the deployment is successful, the
elasticsearch-legacy
service should be running in your EKS cluster. Usekubectl
to manage and interact with your Kubernetes resources and services.-