Deploy the oracledb-exporter helm chart on Linode Kubernetes Engine
TypeScriptTo deploy the
oracledb-exporter
helm chart on Linode Kubernetes Engine using Pulumi, you will need to execute a few steps:- Set up the Linode Kubernetes Engine (LKE) cluster using Pulumi.
- Install the Helm Chart for the OracleDB exporter on the LKE cluster.
Below you will find a Pulumi program written in TypeScript that does just that.
First, you will need to import the necessary Pulumi and Helm modules for creating a Kubernetes cluster and for deploying a Helm Chart. The Pulumi program below uses the
@pulumi/linode
and@pulumi/kubernetes
packages. If you don't have them installed, you can do this via npm or yarn:npm install @pulumi/linode @pulumi/kubernetes
or
yarn add @pulumi/linode @pulumi/kubernetes
After installing the necessary packages, you can use the following TypeScript code which comments explain step by step:
import * as pulumi from '@pulumi/pulumi'; import * as linode from '@pulumi/linode'; import * as k8s from '@pulumi/kubernetes'; // Create a new Linode Kubernetes Engine (LKE) cluster const cluster = new linode.LkeCluster('my-cluster', { region: 'us-central', // Replace with the preferred region k8sVersion: '1.21', // Use a version supported by LKE nodePools: [{ count: 2, // Desired number of nodes in the pool type: 'g6-standard-2' // Type of node; select based on requirements }], }); // Export the kubeconfig export const kubeconfig = cluster.kubeconfig; // Create a Kubernetes provider using the kubeconfig from the LKE cluster const k8sProvider = new k8s.Provider('k8sProvider', { kubeconfig: cluster.kubeconfig, }); // Deploy the oracledb-exporter Helm chart const oracledbExporterChart = new k8s.helm.v3.Chart('oracledb-exporter', { // You may need to specify a repo where the oracledb-exporter chart is located. // For this example I'm assuming it's in the 'stable' repo // which probably needs to be replaced with the actual repo URL. chart: 'oracledb-exporter', version: '0.1.0', // Use the correct chart version fetchOpts:{ repo: 'https://charts.bitnami.com/bitnami', }, }, { provider: k8sProvider }); // Export the status of the deployed helm chart export const helmStatus = oracledbExporterChart.status;
This program follow these steps:
-
It initializes a new LKE cluster with the parameters provided, which results in a kubeconfig. You may opt to customize the region, Kubernetes version, and node count/type to fit your requirements.
-
It then exports the kubeconfig, which allows you to connect to your cluster with
kubectl
and manage your Kubernetes resources. -
A new Pulumi Kubernetes provider is instantiated using the kubeconfig from the newly created LKE cluster. This provider will be used to manage Kubernetes resources on that cluster.
-
Lastly, it deploys the OracleDB exporter using a Helm Chart. In the example, the
bitnami
Helm repository is used; you should replace this with the correct repository where theoracledb-exporter
chart is hosted, along with the correct version number. The Helm chart is a predefined package that includes all the necessary Kubernetes resources and their configurations.
At the end, we export the status of the Helm Chart to ensure that we can observe its deployment status outside of Pulumi using
pulumi stack output helmStatus
.Make sure to run
pulumi up
to provision the resources as defined in this program. Once the resources are created, you can monitor the status in the Pulumi console or via the Pulumi CLI.