Deploy the kiali-operator helm chart on Kubernetes
TypeScriptTo deploy the Kiali Operator using a Helm chart on a Kubernetes cluster with Pulumi, you will use the
kubernetes.helm.v3.Chart
resource. This resource allows you to deploy Helm charts into your Kubernetes cluster. Helm charts help define, install, and upgrade even the most complex Kubernetes applications.Here's a Pulumi program written in TypeScript that deploys the Kiali Operator Helm chart.
Before you run this code, ensure that you have:
- Installed Pulumi CLI and set up your Pulumi account.
- Configured your Kubernetes cluster on your cloud provider or locally and have
kubectl
access to it. - Set your current context to the desired Kubernetes cluster where you want to deploy the chart.
Below is the program that deploys the helm chart for Kiali Operator:
import * as k8s from "@pulumi/kubernetes"; const namespace = 'kiali-operator'; // Define the namespace where Kiali Operator will be installed // This line ensures the namespace exists const ns = new k8s.core.v1.Namespace(namespace, { metadata: { name: namespace } }); // Deploy the Kiali Operator Helm chart const kialiOperatorChart = new k8s.helm.v3.Chart('kiali-operator', { chart: 'kiali-operator', // The name of the chart version: '1.29.0', // Specify the version of the chart, adjust to the version you need namespace: namespace, // The namespace where the chart will be installed fetchOpts: { // You need to specify the repo where the chart can be found repo: 'https://kiali.org/helm-charts', }, // Optionally, specify the values for the chart // values: { // key: value, // }, }, { dependsOn: ns }); // Ensure that the namespace creation is completed export const kialiOperatorChartVersion = kialiOperatorChart.version; // Optionally, export the chart version
This program does the following:
- Imports the
@pulumi/kubernetes
package, which contains methods and types for interacting with Kubernetes resources. - Defines a namespace for the Kiali Operator. Ensure you update the
namespace
variable if you want to use a different one. A Kubernetes Namespace allows you to partition resources into logically named groups. - Uses
core.v1.Namespace
to create the namespace if it does not exist. - Deploys the Kiali Operator using
helm.v3.Chart
, which encapsulates the Helm chart details that Pulumi will apply to your cluster.- The
chart
parameter is the name of the Helm chart you want to deploy. - The
version
parameter specifies the version of the chart you want to deploy. - The
namespace
parameter tells Pulumi in which namespace to deploy the chart. - The
fetchOpts.repo
is required to point to the Helm repository where the chart is hosted.
- The
- Optionally, you can set chart
values
to customize the deployment. This is done by providing an object to thevalues
property. - Exports the version of the Kiali Operator Helm chart as an output of the Pulumi program.
After setting up your Pulumi program, you can run
pulumi up
from your terminal, which will execute the deployment. Ensure yourkubectl
is configured to point to the cluster you want to deploy resources into. Pulumi will interact with your Kubernetes cluster, create the defined namespace if it doesn't exist, and deploy the Kiali Operator Helm chart into the namespace.If you need to change configuration values for the Helm chart, use the
values
property of the chart resource and pass an object with your configuration options as key-value pairs. This data structure should match the configuration options defined by the Helm chart itself.