Deploy the fluentd-kubernetes-aws helm chart on AWS EKS
TypeScriptIn order to deploy the
fluentd-kubernetes-aws
Helm chart on an AWS EKS cluster, we will need to follow these high-level steps:- Set up an AWS EKS cluster: We will create an EKS cluster using Pulumi's
aws
oreks
package. For simplicity, we will use theeks
package as it provides a higher level of abstraction. - Install the Helm chart: Once we have the EKS cluster running, we will deploy the
fluentd-kubernetes-aws
Helm chart into our cluster.
Below is a detailed TypeScript program using Pulumi for these steps:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create the EKS cluster. const cluster = new eks.Cluster("my-cluster", { instanceType: "t2.medium", desiredCapacity: 2, minSize: 1, maxSize: 3, }); // Export the cluster’s kubeconfig. export const kubeconfig = cluster.kubeconfig; // Step 2: Deploy the fluentd-kubernetes-aws Helm chart. const fluentdChart = new k8s.helm.v3.Chart("fluentd-chart", { chart: "fluentd-kubernetes-aws", // You typically obtain from a chart repository like 'https://fluent.github.io/helm-charts' fetchOpts: { repo: "https://your-chart-repo/", }, namespace: "kube-system", // Values from the Helm chart's values.yaml, may be used to configure the deployment. values: { // These value placeholders need to be replaced with actual configuration applicable to your environment. // e.g., configure the awsRegion, awsAccessKeyId, awsSecretAccessKey, etc. }, }, { provider: cluster.provider }); // Export the fluentd Chart details like status, etc. export const chartStatus = fluentdChart.status;
Let's break down the program:
-
We create an EKS cluster named
my-cluster
usingnew eks.Cluster()
. We specify theinstanceType
, desired, minimum, and maximum capacity of the worker nodes. -
We then export
kubeconfig
, which can be used to interact with the cluster viakubectl
or any Kubernetes client. This is not necessary for our Pulumi program to operate but may be useful for debugging or manual inspection. -
In the next step, we deploy the
fluentd-kubernetes-aws
Helm chart usingnew k8s.helm.v3.Chart()
. Here, we specify the Helm chart name, the repository where the chart is located (you must replace"https://your-chart-repo/"
with the actual repo URL), and any values that need to be overwritten in thevalues.yaml
file of the Helm chart. -
We then export the status of our Helm chart deployment as
chartStatus
. This will give us information about the deployed chart once we run our Pulumi program.
To run this program:
- Ensure you have Pulumi CLI and AWS CLI installed and configured.
- Create a new Pulumi project and replace the content of
index.ts
with the above code. - Replace placeholder values (like
repo
URL and any values insidevalues
object) with actual values to configurefluentd-kubernetes-aws
according to your environment. - Run
pulumi up
to preview and deploy the resources.
Remember that managing cloud resources will incur costs, and you should make sure to understand the pricing for EKS and any other AWS resources used in this program.
- Set up an AWS EKS cluster: We will create an EKS cluster using Pulumi's