apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql-exporter
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      k8s-app: mysql-exporter
  template:
    metadata:
      labels:
        k8s-app: mysql-exporter
      name: mysql-exporter
    spec:
      containers:
        - image: prom/mysqld-exporter:latest
          imagePullPolicy: "Always"
          env:
            - name: DATA_SOURCE_NAME
              value: "root:root_password@(cluster1-haproxy.pxc.svc.cluster.local:3306)/"
          args:
            - "--collect.info_schema.processlist"
            - "--collect.info_schema.innodb_metrics"
            - "--collect.info_schema.tablestats"
            - "--collect.info_schema.userstats"
            - "--collect.engine_innodb_status"
            - "--collect.slave_hosts"
          name: mysql-exporter
          ports:
            - containerPort: 9104
              name: mysql-metrics
