Deploy the sysdig-mcm-navmenu helm chart on Oracle Kubernetes Engine (OKE)
TypeScriptDeploying a Helm chart to a Kubernetes cluster involves several steps, particularly when targeting a specific Kubernetes engine like Oracle Kubernetes Engine (OKE). With Pulumi, you can automate the deployment of such Helm charts by scripting the entire process in languages like TypeScript.
Below, I will guide you through the process of deploying the
sysdig-mcm-navmenu
Helm chart onto an OKE cluster using Pulumi.Firstly, we'll ensure that we have the necessary Pulumi providers to interact with Kubernetes and Helm. In this case, we need the
pulumi-kubernetes
package to communicate with the Kubernetes cluster and manage the Helm chart deployment.Step 1: Set up the Pulumi Kubernetes Provider
We start by creating a new Pulumi project and setting up the Kubernetes provider to connect to our Oracle Kubernetes Engine.
Before running the Pulumi program, make sure you have your OKE cluster access configured locally. Typically, this involves setting up your kubeconfig file with the necessary access credentials to your OKE cluster. Pulumi will use this kubeconfig file to communicate with your cluster.
Step 2: Deploy the Helm Chart
To deploy the Helm chart, we will use the
Chart
resource from the@pulumi/kubernetes
package. This resource represents a Helm chart in Pulumi’s Kubernetes provider. It allows us to specify the chart name, version, and any custom values we might need to provide to the chart.Below is a Pulumi program that performs the deployment:
import * as k8s from "@pulumi/kubernetes"; // Assume that the OKE cluster has been configured and context has been set up in the kubeconfig file. // Create a new Kubernetes provider instance using the context for your OKE cluster. const provider = new k8s.Provider("oke-provider", { kubeconfig: "<YOUR_KUBECONFIG_CONTENTS>", }); // Deploy the sysdig-mcm-navmenu Helm chart. const sysdigChart = new k8s.helm.v3.Chart("sysdig-mcm-navmenu", { chart: "sysdig-mcm-navmenu", // If the chart is from a custom Helm repo, specify `repo` attribute here. // Optionally, specify the chart version you wish to deploy. version: "1.0.0", // If you have any custom values you wish to override, specify them here. values: { // Provide configuration values here. For example: // property1: value1, // property2: value2, }, }, { provider }); // Export any resource properties you need, such as the deployed service endpoint. export const chartName = sysdigChart.metadata.apply(m => m.name);
Here's what each part of the TypeScript program does:
- The
@pulumi/kubernetes
package is imported to use Kubernetes resources within our Pulumi program. - A new
Provider
instance is created, representing the connection to our OKE cluster. Replace<YOUR_KUBECONFIG_CONTENTS>
with the actual contents of yourkubeconfig
file. - A new
Chart
instance is created, which represents thesysdig-mcm-navmenu
Helm chart. You should specify the name of the chart, its version, and any custom values you wish to override. If this Helm chart is hosted on a custom Helm repository, you must also provide therepo
attribute. - An export statement is included to output the name of the Helm chart after it has been deployed. This can be useful for referencing the Helm release in other parts of your infrastructure or applications.
Please replace
<YOUR_KUBECONFIG_CONTENTS>
with your actual kubeconfig file contents, or provide it through a secure means if you're running this program in a CI/CD pipeline or automated environment.To apply this Pulumi program, follow these steps:
- Save the program in a file named
index.ts
. - Initialize a new Pulumi project with
pulumi new
if you haven't already set one up. - Run
npm install
to install the Pulumi Kubernetes SDK package (@pulumi/kubernetes
). - Execute
pulumi up
to preview and deploy the changes. You'll be prompted to confirm the deployment after reviewing the preview.
This program assumes you already have an Oracle Kubernetes Engine cluster running and that your kubeconfig file is correctly set up for access. If you need to create an OKE cluster, you would include additional Pulumi resources for provisioning the cluster in Oracle Cloud before deploying the Helm chart.
- The