add mysqld-exporter

main
ycz008 2024-04-15 11:46:37 +08:00
parent 8287dc28b2
commit 288f0e085b
1 changed files with 81 additions and 0 deletions

View File

@ -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