Deploy the openshift-logforwarding-splunk helm chart on AWS EKS
TypeScriptTo deploy the
openshift-logforwarding-splunk
Helm chart on an Amazon EKS cluster using Pulumi, you will first need to create an EKS cluster. After the cluster is up and running, you can then use Pulumi's Helm chart support to deploy the chart on the cluster.Here’s a detailed breakdown of the steps we will follow in the Pulumi program:
-
Set Up EKS Cluster: We will create an EKS cluster, using AWS EKS resources. This involves setting up the necessary IAM roles and VPC configuration for the EKS cluster to run.
-
Deploy Helm Chart: Once the cluster is ready, we will deploy the
openshift-logforwarding-splunk
Helm chart to the cluster. We will need the chart’s repository URL to fetch and install it.
Below is a Pulumi TypeScript program that accomplishes 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"; // Step 1: Create an EKS cluster // Create an EKS cluster with the default configuration. This will create the required VPC, IAM roles, and an EKS cluster. // Visit https://www.pulumi.com/registry/packages/eks/api-docs/cluster/ for `eks.Cluster` API documentation. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, // specify the desired number of cluster nodes minSize: 1, // specify the minimum number of cluster nodes maxSize: 3, // specify the maximum number of cluster nodes }); // Export the kubeconfig for the EKS cluster. // This allows you to interact with the cluster with `kubectl` and perform other operations. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the Helm Chart // Using the `k8s.helm.v3.Chart` resource to deploy the `openshift-logforwarding-splunk` Helm chart. // Visit https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/chart/ for `k8s.helm.v3.Chart` API documentation. const logforwardingChart = new k8s.helm.v3.Chart("openshift-logforwarding-splunk", { chart: "openshift-logforwarding-splunk", version: "1.2.3", // specify the chart version, change to the appropriate version fetchOpts: { repo: "https://charts.helm.sh/stable", // replace with the correct repository URL containing the Helm chart }, namespace: "logging", // specify the namespace where you want to deploy the Helm chart }, { provider: cluster.provider }); // You can customize the Helm chart deployment by providing configuration values. // For example, to set Splunk specific configurations, you can pass a `values` object to the Chart resource.
The code above creates an EKS cluster and installs the
openshift-logforwarding-splunk
Helm chart within it. Make sure to replace placeholder values like1.2.3
and the Helm chart repository URL with actual values based on the chart you want to install.To apply this program and create the infrastructure, you will need to execute it using the Pulumi CLI:
- Save the code to a file, say
index.ts
. - Ensure you have the necessary Pulumi stack files and have logged into the Pulumi CLI.
- Run
pulumi up
to preview and deploy the changes.
The EKS cluster creation will take some time, and once it's up, the Helm chart will be deployed to the cluster. After the deployment, you can use the exported
kubeconfig
to interact with your Kubernetes cluster viakubectl
.-