-
Notifications
You must be signed in to change notification settings - Fork 343
Updated MySQL Prometheus documentation #596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated MySQL Prometheus documentation #596
Conversation
|
Looking at the mysql-exporter README, I think the config map approach is more recommended as a best practice for security:
On the topic of best practices, I see that we're defining a non-root user for mysql in this toy example: So should we use that instead of root for the exporter's auth? Happy to help test this if you update the yaml! |
Sounds good, I will update the documentation to show the example that uses the configuration file. The non-root user that is defined is used while running |
| + volumeMounts: | ||
| + - mountPath: /home/my.cnf | ||
| + subPath: my.cnf | ||
| + name: mysql-exporter-config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried applying this yaml and got
create Pod mysql-0 in StatefulSet mysql failed error: Pod "mysql-0" is invalid: spec.containers[1].volumeMounts[0].name: Not found: "mysql-exporter-config"
Looks like we need to define a volume that corresponds to the volumeMount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the yaml to include a volumeMount and I'm wondering, do we want the + symbols with the configmap that is included in the example as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so.
In some cases like the nginx one, you can reasonably expect that anyone setting up nginx on k8s will have a configmap set up, so we just use "+"s to indicate the lines they need to add to the config map.
In this case, if you already had a mysql instance up and running, and then you were adding an exporter, you wouldn't already have a configmap with credentials beforehand, so the volume, volumemount, configmap are all indicated with "+"s.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so, I pushed changes to include the + symbols with the configmap unsure if we need all of them.
| multiple_dashboards: false | ||
| dashboard_display_name: {{app_name_short}} Prometheus Overview | ||
| config_mods: | | ||
| apiVersion: apps/v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per the other example, we can update https://github.com/GoogleCloudPlatform/prometheus-engine/blob/main/examples/mysql/exporter.yaml.snippet directly (after addressing the other comments here)
But unlike the consul example, this PR doesn't become completely obsolete -- we do still need to update this file because of the change you made in line 70 (additional_install_info).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, just for clarity I wanted to make sure that the line you're mentioning here doesn't need to be changed? We just want to update things in this repo and the other one, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
…o container section
* updated the minimum exporter version, example configuration, and additional install info * updated the minimum supported version in metadata * update config example to pass a config file as an argument * reverted min versions, added volume to the config example that mounts the mysql exporter config * added + symbols for configmap in example yaml * removed a few dashes, updated the volume section, added mysql image to container section
Changes
Details
The latest version of the MySQL Prometheus exporter works with MySQL 5.7 and MySQL 8.0.34. This new version of the exporter removes the
DATA_SOURCE_NAMEenvironment variable and instead we can pass in the--mysqld.usernameargument and theMYSQLD_EXPORTER_PASSWORDenvironment variable for authentication, or we can mount a configuration file with the credentials in it and pass the--config.my-cnf=<PATH_TO_MOUNTED_CONFIG_FILE>.Example configuration file:
I'm not sure which option to go with for the example configuration and wanted to get an opinion, we could change it to look something like