prometheus-mysql-exporter

by Helm

Helm chartv0.2.4App v0.11.0

A Helm chart for prometheus mysql exporter with cloudsqlproxy

About this chart

Prometheus Mysql Exporter

TL;DR;

$ helm install stable/prometheus-mysql-exporter

Introduction

This chart bootstraps a prometheus mysql exporter deployment on a Kubernetes cluster using the Helm package manager. The exporter can connect to mysql directly or using the Cloud SQL Proxy.

Installing the Chart

To install the chart with the release name my-release:

$ helm install --name my-release stable/prometheus-mysql-exporter --set datasource="username:password@(db:3306)/"

The command deploys a mysql exporter on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

Uninstalling the Chart

To uninstall/delete the my-release deployment:

$ helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Configuration

The following table lists the configurable parameters of the mysql exporter chart and their default values.

ParameterDescriptionDefault
replicaCountAmount of pods for the deployment1
image.repositoryImage repositoryprom/mysqld-exporter
image.tagImage tagv0.11.0
image.pullPolicyImage pull policyIfNotPresent
service.nameService namemysql-exporter
service.typeService typeClusterIP
service.externalportThe service port9104
service.internalPortThe target port of the container9104
resourcesCPU/Memory resource requests/limits{}
annotationspod annotations for easier discovery{}
mysql.dbMySQL connection db (optional)""
mysql.hostMySQL connection hostlocalhost
mysql.paramMySQL connection parameters (optional)"tcp"
mysql.passMySQL connection passwordpassword
mysql.portMySQL connection port3306
mysql.protocolMySQL connection protocol (optional)""
mysql.userMySQL connection usernameexporter
cloudsqlproxy.enabledFlag to enable the connection using Cloud SQL Proxyfalse
cloudsqlproxy.image.repoCloud SQL Proxy image repositorygcr.io/cloudsql-docker/gce-proxy
cloudsqlproxy.image.tagCloud SQL Proxy image tag1.11
cloudsqlproxy.image.pullPolicyCloud SQL Proxy image pull policyIfNotPresent
cloudsqlproxy.instanceConnectionNameGoogle Cloud instance connection nameproject:us-central1:dbname
cloudsqlproxy.portCloud SQL Proxy listening port3306
cloudsqlproxy.credentialsCloud SQL Proxy service account credentialsbogus credential file

Specify each parameter using the --set key=value[,key=value] argument to helm install. For example,

$ helm install --name my-release \
  --set mysql.user="username",mysql.password="password",mysql.host="localhost",mysql.port="3306"  \
    stable/prometheus-mysql-exporter

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

$ helm install --name my-release -f values.yaml stable/prometheus-mysql-exporter

Documentation for the MySQL Exporter can be found here: (https://github.com/prometheus/mysqld_exporter) A mysql params overview can be found here: (https://github.com/go-sql-driver/mysql#dsn-data-source-name)

Deploy prometheus-mysql-exporter with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has prometheus-mysql-exporter on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartprometheus-mysql-exporter is pinned at v0.2.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply