prometheus-mysql-exporter
by Helm
A Helm chart for prometheus mysql exporter with cloudsqlproxy
About this chart
Prometheus Mysql Exporter
- Installs 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.
| Parameter | Description | Default |
|---|---|---|
replicaCount | Amount of pods for the deployment | 1 |
image.repository | Image repository | prom/mysqld-exporter |
image.tag | Image tag | v0.11.0 |
image.pullPolicy | Image pull policy | IfNotPresent |
service.name | Service name | mysql-exporter |
service.type | Service type | ClusterIP |
service.externalport | The service port | 9104 |
service.internalPort | The target port of the container | 9104 |
resources | CPU/Memory resource requests/limits | {} |
annotations | pod annotations for easier discovery | {} |
mysql.db | MySQL connection db (optional) | "" |
mysql.host | MySQL connection host | localhost |
mysql.param | MySQL connection parameters (optional) | "tcp" |
mysql.pass | MySQL connection password | password |
mysql.port | MySQL connection port | 3306 |
mysql.protocol | MySQL connection protocol (optional) | "" |
mysql.user | MySQL connection username | exporter |
cloudsqlproxy.enabled | Flag to enable the connection using Cloud SQL Proxy | false |
cloudsqlproxy.image.repo | Cloud SQL Proxy image repository | gcr.io/cloudsql-docker/gce-proxy |
cloudsqlproxy.image.tag | Cloud SQL Proxy image tag | 1.11 |
cloudsqlproxy.image.pullPolicy | Cloud SQL Proxy image pull policy | IfNotPresent |
cloudsqlproxy.instanceConnectionName | Google Cloud instance connection name | project:us-central1:dbname |
cloudsqlproxy.port | Cloud SQL Proxy listening port | 3306 |
cloudsqlproxy.credentials | Cloud SQL Proxy service account credentials | bogus 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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartprometheus-mysql-exporter is pinned at v0.2.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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