上一篇已經有點太多了 容許我分兩篇 不然有點爆炸
如果蓋完之後 要增新的話
1.去資料庫增加有process, replication權限的帳號
CREATE USER 'yc'@'%' IDENTIFIED BY 'yc';
grant process, replication client on *.* to 'yc'@'%';                  
2.deployment裡面的livenessProbe的command增加
nohup mysqld_exporter
  --web.listen-address=$podIP:9107 --config.my-cnf=/etc/.90.cnf &
- /bin/sh
- '-c'
- >-
  nohup mysqld_exporter --web.listen-address=$podIP:9105
  --config.my-cnf=/etc/.57.cnf & nohup mysqld_exporter
  --web.listen-address=$podIP:9106 --config.my-cnf=/etc/.80.cnf
  & exit
變成
  nohup mysqld_exporter --web.listen-address=$podIP:9105
  --config.my-cnf=/etc/.57.cnf & nohup mysqld_exporter
  --web.listen-address=$podIP:9106 --config.my-cnf=/etc/.80.cnf
  & nohup mysqld_exporter --web.listen-address=$podIP:9107
  --config.my-cnf=/etc/.90.cnf &exit
3.service 多開port號
ports:
    - name: YCdata1
      protocol: TCP
      port: 9104
      targetPort: 9104
    - name: YCdata2
      protocol: TCP
      port: 9105
      targetPort: 9105
    - name: YCdata3
      protocol: TCP
      port: 9106
      targetPort: 9106
->
 ports:
    - name: YCdata1
      protocol: TCP
      port: 9104
      targetPort: 9104
    - name: YCdata2
      protocol: TCP
      port: 9105
      targetPort: 9105
    - name: YCdata3
      protocol: TCP
      port: 9106
      targetPort: 9106
    - name: YCdata4
      protocol: TCP
      port: 9107
      targetPort: 9107
4.servicemonitor 改成你喜歡的名字
 endpoints:
    - interval: 15s
      port: YCdata1
      relabelings:
        - targetLabel: instance
          replacement: YCdata1
    - interval: 15s
      port: YCdata2
      relabelings:
        - targetLabel: instance
          replacement: YCdata2
    - interval: 15s
      port: YCdata3
      relabelings:
        - targetLabel: instance
          replacement: YCdata3
  endpoints:
   - interval: 15s
     port: YCdata1
     relabelings:
       - targetLabel: instance
         replacement: YCdata1
   - interval: 15s
     port: YCdata2
     relabelings:
       - targetLabel: instance
         replacement: YCdata2
   - interval: 15s
     port: YCdata3
     relabelings:
       - targetLabel: instance
         replacement: YCdata3
   - interval: 15s
     port: YCdata4
     relabelings:
       - targetLabel: instance
         replacement: YCdata4      
done.