Deploy the fluentbit-resource helm chart on AWS EKS
TypeScriptTo deploy the
fluentbit
Helm chart on AWS EKS using Pulumi, you'll need to perform a few steps:- Create an EKS cluster if you don't have one already.
- Deploy the
fluentbit
Helm chart to the EKS cluster.
We will be using the
@pulumi/eks
package to create an EKS cluster and then the@pulumi/kubernetes
package to deploy thefluentbit
chart to that cluster.Below is a TypeScript program for Pulumi that carries out these tasks:
import * as eks from "@pulumi/eks"; import * as k8s from "@pulumi/kubernetes"; // Create an EKS cluster. const cluster = new eks.Cluster("my-cluster", { desiredCapacity: 2, minSize: 1, maxSize: 2, // other configurations ... }); // Export the clusters' kubeconfig. export const kubeconfig = cluster.kubeconfig; // Deploy the `fluentbit` Helm chart to the EKS cluster const fluentbitChart = new k8s.helm.v3.Chart("fluentbit", { chart: "fluentbit", repo: "fluent", // This is an example repo; you need to specify the correct one. version: "0.15.0", // Specify the version of fluentbit you wish to deploy namespace: "kube-system", // Values from the Helm chart's values.yaml file can be provided here. values: { // example configuration values here. For fluentbit, // you might want to set up things like backend configuration, // resource limits, or other options }, }, { provider: cluster.provider }); // Export the Fluentbit Helm chart resources export const fluentbit = fluentbitChart.resources;
Explanation:
-
We are importing two packages;
@pulumi/eks
is used to provision an EKS cluster on AWS and@pulumi/kubernetes
to work with Kubernetes resources including deploying Helm charts. -
eks.Cluster
: This creates a new EKS cluster with the specified configuration. In this code, I've shown a minimal configuration, but there are several other options you can specify, such as the region, VPC settings, and node size. -
kubeconfig
: It is crucial to export the kubeconfig from the cluster so that you can interact with your Kubernetes cluster usingkubectl
or other Kubernetes tools. -
k8s.helm.v3.Chart
: This Pulumi resource is used to deploy a Helm chart. In this case, it is thefluentbit
chart, which will deploy Fluent Bit to our EKS cluster in thekube-system
namespace. There's a placeholder value for the repository; you should replace it with the correct repository URL where thefluentbit
Helm chart is hosted.
Make sure you have Pulumi installed, and the AWS CLI set up and configured before running this Pulumi program. Create a new Pulumi project, copy the provided program, install the required dependencies with
npm
oryarn
, and runpulumi up
to provision the resources. Remember, the actual Helm chart configuration invalues
will vary based on your needs.