From 288f0e085ba5806f5c1631fb9ece2b04341517c5 Mon Sep 17 00:00:00 2001 From: ycz008 Date: Mon, 15 Apr 2024 11:46:37 +0800 Subject: [PATCH] add mysqld-exporter --- prod-upgrade/prom/mysql-exporter.yaml | 81 +++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 prod-upgrade/prom/mysql-exporter.yaml diff --git a/prod-upgrade/prom/mysql-exporter.yaml b/prod-upgrade/prom/mysql-exporter.yaml new file mode 100644 index 0000000..3c4a4df --- /dev/null +++ b/prod-upgrade/prom/mysql-exporter.yaml @@ -0,0 +1,81 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: mysqld-exporter +data: + config: |- + [client] + user = exporter + password = beaconfire@2024! + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysql-exporter +spec: + replicas: 1 + selector: + matchLabels: + app: mysql-exporter + template: + metadata: + labels: + app: mysql-exporter + spec: + containers: + - name: mysql-exporter + image: prom/mysqld-exporter:v0.15.1 + imagePullPolicy: Always + args: + - --no-collect.info_schema.innodb_cmp + - --no-collect.info_schema.innodb_cmpmem + - --no-collect.global_variables + volumeMounts: + - name: config.my-cnf + mountPath: /etc/my.cnf + subPath: my.cnf + readOnly: true + resources: + requests: + cpu: 0.01 + memory: 128Mi + limits: + cpu: 0.1 + memory: 512Mi + volumes: + - name: config.my-cnf + configMap: + name: mysqld-exporter + items: + - key: config + path: my.cnf + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: "app.kubernetes.io/component" + operator: In + values: + - mysql + tolerations: + - key: "app.kubernetes.io/component" + operator: "Equal" + value: "mysql" + effect: "NoSchedule" +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql-exporter +spec: + type: ClusterIP + ports: + - name: http + protocol: TCP + port: 8761 + targetPort: http + selector: + app: mysql-exporter \ No newline at end of file