1. Deploy the wazuh helm chart on Oracle Kubernetes Engine (OKE)

    TypeScript

    To deploy the Wazuh Helm chart on Oracle Kubernetes Engine (OKE), you'll need to set up the OKE cluster and configure Kubernetes and Helm with Pulumi. In this program, we will:

    1. Create an OKE cluster (if you don't have one already).
    2. Use the oci.ContainerEngine.Cluster to set up the Kubernetes cluster.
    3. Use the kubernetes package, specifically kubernetes.helm.v3.Chart, to deploy the Wazuh Helm chart.

    To do this, you will need to have an Oracle Cloud Infrastructure (OCI) account configured with the necessary policies to create and manage OKE clusters, as well as the credentials set up for Pulumi to use. This program assumes you have already set up your OCI provider configuration with Pulumi and installed the Pulumi CLI.

    Here's the TypeScript program that accomplishes these steps:

    import * as pulumi from "@pulumi/pulumi"; import * as oci from "@pulumi/oci"; import * as k8s from "@pulumi/kubernetes"; // Step 1: Create or configure OKE Cluster const compartment = "your-oci-compartment-ocid"; const vcnId = "your-virtual-cloud-network-ocid"; const kubeVersion = "v1.20.8"; // specify the desired Kubernetes version // Create an OCI OKE cluster const cluster = new oci.ContainerEngine.Cluster("wazuh-cluster", { compartmentId: compartment, kubernetesVersion: kubeVersion, options: { // Customize your cluster options as necessary serviceLbSubnetIds: [], // Provide the subnet IDs for Load Balancer, if necessary kubernetesNetworkConfig: { // Update the network configuration to your requirements podsCidr: "10.244.0.0/16", servicesCidr: "10.96.0.0/16", }, // ... add other options like addons according to your cluster needs }, // Specify VCN and other required properties vcnId: vcnId, // Customize tags, shape, and other configurations as needed }); // Step 2: Configure the Kubernetes provider to connect to the OKE cluster const k8sProvider = new k8s.Provider("wazuh-k8s", { // Use the kubeconfig provided by OCI OKE to connect to the cluster kubeconfig: cluster.kubeconfigs[0].content.apply(c => Buffer.from(c, 'base64').toString()), }); // Step 3: Deploy the Wazuh Helm chart on OKE const wazuhChart = new k8s.helm.v3.Chart("wazuh", { chart: "wazuh", version: "4.2.5", // Pick the version of the Wazuh chart you wish to deploy fetchOpts: { repo: "https://wazuh.github.io/wazuh-charts", // Wazuh Helm chart repository URL }, values: { // Specify any custom values for your Wazuh Helm chart deployment // Refer to the specific Helm chart for which values you can configure }, }, { provider: k8sProvider }); // Export the cluster's kubeconfig export const kubeConfig = cluster.kubeconfigs[0].content.apply(content => Buffer.from(content, 'base64').toString());

    In this program:

    • We define the OCI compartment and VCN ID.
    • We create a new Kubernetes cluster in Oracle's Container Engine for Kubernetes (OKE) using oci.ContainerEngine.Cluster.
    • We create a Kubernetes provider using @pulumi/kubernetes, which lets us interact with the Kubernetes cluster. It utilizes the kubeconfig we get from the OKE cluster resources to establish the connection.
    • We use kubernetes.helm.v3.Chart to deploy the Wazuh Helm chart from the specified Helm repository. You can further customize this with values according to your requirements. To find available configurations, look at the Wazuh Helm Chart documentation.
    • Finally, we export the cluster's kubeconfig so you can use kubectl to interact with the cluster outside of Pulumi.

    Be sure to replace placeholder values with actual values from your OCI setup. This would typically be done in a configuration file or through Pulumi's stack configuration, but for clarity, we've written them explicitly here.

    Before running this Pulumi program, ensure you have the Pulumi CLI installed and are logged into your OCI account. You will run the program by executing the pulumi up command in the directory containing your Pulumi program. After confirming the changes, Pulumi will provision your infrastructure as code.