Deploy the simple-grafana helm chart on Linode Kubernetes Engine
TypeScriptTo deploy a Helm Chart, such as
simple-grafana
, on Linode Kubernetes Engine using Pulumi, you will utilize thekubernetes.helm.v3.Chart
resource from the Pulumi Kubernetes provider. This resource allows you to deploy Helm charts to a Kubernetes cluster.First, you need to have a Linode Kubernetes Engine (LKE) cluster up and running. Typically, you'd use Pulumi to provision an LKE cluster as well, but since that's not what we're focusing on here, let's assume that you've already set one up and configured
kubectl
to connect to your LKE cluster. You should also ensure thathelm
is set up and configured correctly.Here's a Pulumi program in TypeScript that demonstrates how to deploy the
simple-grafana
Helm chart to your LKE cluster. This program will import the necessary packages, create a Kubernetes provider that communicates with your cluster, and then deploy the Helm chart using thekubernetes.helm.v3.Chart
resource.import * as kubernetes from "@pulumi/kubernetes"; const clusterName = "my-lke-cluster"; // Replace with your cluster name // Create a Kubernetes provider instance that uses the current context from kubeconfig const k8sProvider = new kubernetes.Provider("lke-k8s-provider", { kubeconfig: `path-to-your-kubeconfig-file`, // Replace with the path to your kubeconfig file }); // Use the `kubernetes.helm.v3.Chart` resource to deploy simple-grafana const simpleGrafanaChart = new kubernetes.helm.v3.Chart("simple-grafana", { chart: "grafana", version: "6.1.17", // Specify the version number of the chart if necessary fetchOpts: { repo: "https://grafana.github.io/helm-charts", // URL to Helm repo where simple-grafana is hosted }, }, { provider: k8sProvider }); // Export the URL of the Grafana dashboard if service type is LoadBalancer/NodePort export const grafanaUrl = simpleGrafanaChart.getResourceProperty("v1/Service", "simple-grafana", "status").apply( status => status.loadBalancer.ingress[0].ip || status.loadBalancer.ingress[0].hostname );
In the above program, replace
"path-to-your-kubeconfig-file"
with the actual path to your kubeconfig file that allows access to your LKE cluster.Also, note the
export
statement at the end. This will show the URL for Grafana in your Pulumi stack output, which you can use to access the Grafana dashboard. This assumes that the service type set in the Helm chart defaults toLoadBalancer
orNodePort
.Make sure you have Pulumi installed and configured to use with your Linode account. You can then run this program using the Pulumi CLI:
pulumi up
This will provision the Grafana chart on your LKE cluster. If you haven't set any custom values for the Helm chart in the code above, it will install Grafana with its default settings.
For more documentation and information about the resources used, please visit:
If you need additional customization, you can add a
values
property to thekubernetes.helm.v3.Chart
resource instance, where you can specify values that override the defaults set by the Helm chart.