Deploy the fluentd-kubernetes-daemonset helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptTo deploy the
fluentd-kubernetes-daemonset
Helm chart on Oracle Kubernetes Engine (OKE), you'll need to perform a few steps:-
Set up the OKE cluster: This involves creating a Kubernetes cluster in Oracle Cloud Infrastructure (OCI) using the
oci.ContainerEngine.Cluster
Pulumi resource. -
Configure Kubectl: To interact with the Kubernetes cluster, you'll need to set up
kubectl
and point it to your Oracle Kubernetes Engine cluster. -
Install the Helm Chart: Use the
kubernetes.helm.v3.Chart
resource to deploy thefluentd-kubernetes-daemonset
Helm chart to your cluster.
Here's a TypeScript program that accomplishes the above steps using Pulumi:
import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Replace with the appropriate OCI compartment ID and VCN ID const compartmentId = "ocid1.compartment.oc1..exampleuniqueID"; const vcnId = "ocid1.vcn.oc1..exampleuniqueID"; // Create an OKE cluster const cluster = new oci.containerengine.Cluster("okeCluster", { compartmentId: compartmentId, vcnId: vcnId, kubernetesVersion: "v1.21.5", // specify the version you want options: { serviceLbSubnetIds: ["subnetId1", "subnetId2"], // replace with actual subnet IDs // Additional cluster options can be configured here }, // Add more configuration as needed }); // Use the existing kubeconfig for the OKE cluster // This configuration assumes that you already have a kubeconfig file for the OKE cluster const kubeconfig = new pulumi.Config().require("kubeconfig"); // Create a provider to interact with your OKE cluster. Make sure the `kubeconfig` is set correctly. const provider = new k8s.Provider("okeProvider", { kubeconfig: kubeconfig, }); // Deploy the fluentd-kubernetes-daemonset Helm chart const fluentdChart = new k8s.helm.v3.Chart("fluentd", { chart: "fluentd-kubernetes-daemonset", // In most cases you would use Helm repository, but you may also specify a direct chart path fetchOpts: { repo: "https://fluent.github.io/helm-charts", }, // Specify the namespace and any chart values you wish to override namespace: "kube-system", values: { // Add any values you want to override here }, }, { provider: provider }); // Export the cluster name and Fluentd chart status export const clusterName = cluster.name; export const fluentdStatus = fluentdChart.status;
Explanation:
- This program uses the
@pulumi/oci
package to interact with Oracle Cloud Infrastructure and create a Kubernetes cluster in OCI. - The
oci.containerengine.Cluster
resource is what actually creates the OKE cluster within the specified compartment and VCN ID. - We assume you have your
kubeconfig
ready. It's required for the@pulumi/kubernetes
provider to interact with your Kubernetes cluster. - The
k8s.Provider
resource sets up the Pulumi provider for Kubernetes using thekubeconfig
. - The
k8s.helm.v3.Chart
resource is used to install thefluentd-kubernetes-daemonset
Helm chart into your OKE cluster. We specify the chart name, the Helm repository URL, and any values we want to provide or override for the chart. - The chart is installed into the
kube-system
namespace, which is common for system-wide services like logging. - Finally, we export the
clusterName
and thefluentdStatus
to view these details in the Pulumi output.
To run this Pulumi program:
- Install Pulumi CLI.
- Configure Pulumi to use OCI (if you haven’t done so already).
- Place the
kubeconfig
details in a Pulumi configuration file or pass it directly as an environment variable. - Run
pulumi up
to execute the code and create the resources.
Make sure to replace placeholder values (like compartment ID, VCN ID, subnet IDs, and kubeconfig content) with actual values from your OCI account.
This program does not directly interact with the OCI console or OCI CLI but assumes you have set up the proper credentials to interact with your OCI account through Pulumi.
-