Deploy the openshift-logstash helm chart on AWS EKS
TypeScriptTo deploy the
openshift-logstash
Helm chart on AWS EKS using Pulumi, you need to perform several steps:- Create an Amazon EKS cluster.
- Deploy the Helm chart into the EKS cluster.
We'll use the
@pulumi/eks
and@pulumi/kubernetes
packages to accomplish these tasks. The@pulumi/eks
package simplifies creating and managing an EKS cluster. The@pulumi/kubernetes
package allows us to work with Kubernetes resources, including Helm charts.Explanation
First, we will set up the EKS cluster using the
eks.Cluster
resource, which creates all the necessary components for an EKS cluster. You can customize the resource properties based on your requirements such as the number of nodes, node size, etc.Second, once the cluster is up and running, we will deploy the
openshift-logstash
Helm chart using thekubernetes.helm.v3.Chart
resource. You will need to specify the chart name and repository where the Helm chart is located, as well as any values you wish to override in the Helm chart'svalues.yaml
file.Let's go through the implementation step by step:
import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; import * as eks from "@pulumi/eks"; import * as kubernetes from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("my-eks-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, providerCredentialOpts: { profileName: "aws-profile", // replace with your AWS CLI profile name }, }); // Export the cluster's kubeconfig. export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider instance that uses our EKS cluster. const k8sProvider = new kubernetes.Provider("k8s-provider", { kubeconfig: cluster.kubeconfig.apply(JSON.stringify), }); // Deploy the openshift-logstash Helm chart into the EKS cluster. const logstashChart = new kubernetes.helm.v3.Chart("openshift-logstash", { chart: "logstash", version: "7.14.0", // replace with the actual version of the chart fetchOpts: { repo: "https://helm.elastic.co", // This is an example, replace with the actual Helm chart repository for openshift-logstash }, }, { provider: k8sProvider }); // Export the Helm chart name and version. export const logstashChartName = logstashChart.chart; export const logstashChartVersion = logstashChart.version;
To execute the above program:
- Install Pulumi CLI and set up AWS credentials.
- Create a new Pulumi project and replace its content with the above code.
- Run
pulumi up
to deploy the EKS cluster and theopenshift-logstash
Helm chart.
This program sets up an EKS cluster with
t2.medium
instances and the default node group with desired capacity set to 2. Then, it configures a Kubernetes provider to interact with the cluster usingkubeconfig
. With that provider, it deploys theopenshift-logstash
Helm chart from the specified Helm repository.Once the deployment is successful, Pulumi will output the
kubeconfig
which you can use to interact with your cluster usingkubectl
, as well as the Helm chart name and version that were deployed.Remember to replace the placeholder values such as the AWS CLI profile name, Helm chart version, and Helm repository with the actual values that correspond to your desired
openshift-logstash
Helm chart.Please note that the actual Helm repository URL for the
openshift-logstash
chart is an example and should be replaced with the correct repository that hosts theopenshift-logstash
Helm chart.