--- 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: - "--config.my-cnf=/etc/my.cnf" - "--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