1. Answers
  2. Deploy Prometheus MySQL Exporter on Digital Ocean Kubernetes

How do I deploy the prometheus-mysql-exporter helm chart on Digital Ocean Kubernetes Service?

In this guide, we will deploy the prometheus-mysql-exporter Helm chart on a Digital Ocean Kubernetes Service (DOKS) cluster using Pulumi. We will create a Kubernetes cluster, and then use the Pulumi Kubernetes provider to deploy the Helm chart.

Steps:

  1. Create a Digital Ocean Kubernetes cluster.
  2. Deploy the prometheus-mysql-exporter Helm chart using Pulumi’s Kubernetes provider.
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
import * as k8s from "@pulumi/kubernetes";

// Create a Digital Ocean Kubernetes cluster
const cluster = new digitalocean.KubernetesCluster("my-cluster", {
    region: digitalocean.Region.NYC3,
    version: "1.21.5-do.0",
    nodePool: {
        name: "default",
        size: digitalocean.DropletSlug.DropletS1VCPU2GB,
        nodeCount: 2,
    },
});

// Export the cluster's kubeconfig
export const kubeconfig = cluster.kubeConfigs[0].rawConfig;

// Create a Kubernetes provider instance using the kubeconfig
const k8sProvider = new k8s.Provider("k8sProvider", {
    kubeconfig: kubeconfig,
});

// Deploy the prometheus-mysql-exporter Helm chart
const prometheusMysqlExporter = new k8s.helm.v3.Chart("prometheus-mysql-exporter", {
    chart: "prometheus-mysql-exporter",
    version: "0.5.2",
    fetchOpts: {
        repo: "https://prometheus-community.github.io/helm-charts",
    },
}, { provider: k8sProvider });

Key Points:

  • We created a Kubernetes cluster on Digital Ocean using the digitalocean.KubernetesCluster resource.
  • We exported the cluster’s kubeconfig to use with the Pulumi Kubernetes provider.
  • We deployed the prometheus-mysql-exporter Helm chart using the k8s.helm.v3.Chart resource.

Summary

We successfully deployed the prometheus-mysql-exporter Helm chart on a Digital Ocean Kubernetes Service (DOKS) cluster using Pulumi. This setup allows you to monitor MySQL databases with Prometheus by exporting metrics from the MySQL server.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up