prometheus-mysql-exporter
by KubeGems
A Helm chart for prometheus mysql exporter with cloudsqlproxy
About this chart
Prometheus Mysql Exporter
A Prometheus exporter for MySQL metrics.
This chart bootstraps a Prometheus MySQL Exporter deployment on a Kubernetes cluster using the Helm package manager.
Get Repo Info
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
See helm repo for command documentation.
Install Chart
# Helm 3
$ helm install [RELEASE_NAME] prometheus-community/prometheus-mysql-exporter
# Helm 2
$ helm install --name [RELEASE_NAME] prometheus-community/prometheus-mysql-exporter
See configuration below.
See helm install for command documentation.
Uninstall Chart
# Helm 3
$ helm uninstall [RELEASE_NAME]
# Helm 2
# helm delete --purge [RELEASE_NAME]
This removes all the Kubernetes components associated with the chart and deletes the release.
See helm uninstall for command documentation.
See helm upgrade for command documentation.
Upgrading Chart
# Helm 3 or 2
$ helm upgrade [RELEASE_NAME] [CHART] --install
To =< 1.0.0
Version 1.0.0 is a major update.
- The chart now follows the new Kubernetes label recommendations: https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/
The simplest way to update is to do a force upgrade, which recreates the resources by doing a delete and an install.
helm upgrade prometheus-mysql-exporter prometheus-community/prometheus-mysql-exporter --force
Configuration
See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run these configuration commands:
# Helm 2
$ helm inspect values prometheus-community/prometheus-mysql-exporter
# Helm 3
$ helm show values prometheus-community/prometheus-mysql-exporter
MySQL Connection
The exporter can connect to mysql directly or using the Cloud SQL Proxy.
- To configure direct MySQL connection by value, set
mysql.user,mysql.pass,mysql.hostandmysql.port(see additional options in themysqlconfiguration block) - To configure direct MySQL connnetion by secret, you must store a connection string in a secret, and set
mysql.existingSecretto[SECRET_NAME]
Exporter Documentation and Params
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)
Collector Flags
Available collector flags can be found in the values.yaml and a description of each flag can be found in the mysqld_exporter repository.
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 v1.8.1 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