添加helm仓库

helm repo add bitnami https://charts.bitnami.com/bitnami

拉取仓库

helm pull bitnami/mysql --version 10.3.0 --untar

修改values.yaml

vim value.yaml

# architecture: standalone
architecture: replication

auth:
  rootPassword: "123456"
  # createDatabase: true
  createDatabase: false
  # database: "my_database"
  database: ""
  username: ""
  password: ""
  ##
  replicationUser: replicator
  ##
  replicationPassword: "123456"

已知问题

主从复制失败

解决方案:删除从库,删除pvc,重新拉取主库数据

kubectl scale sts -n mysql mysql-slave --replicas=0
kubectl delete pvc -n mysql data-mysql-slave-0
kubectl scale sts -n mysql mysql-slave --replicas=1