通过helm在k8s上部署mysql主从库
搭建一个主从复制(Master-Slave)的MySQL集群
添加 helm 源
helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts/
helm repo add bitnami https://charts.bitnami.com/bitnami
查看镜像
# helm search repo mysql
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/mysql 8.8.26 8.0.28 MySQL is a fast, reliable, scalable, and easy t...
stable/mysql 0.3.5 Fast, reliable, scalable, and easy to use open-...
bitnami/phpmyadmin 9.0.9 5.1.3 phpMyAdmin is a free software tool written in P...
stable/percona 0.3.0 free, fully compatible, enhanced, open source d...
stable/percona-xtradb-cluster 0.0.2 5.7.19 free, fully compatible, enhanced, open source d...
bitnami/mariadb 10.3.7 10.5.15 MariaDB is an open source, community-developed ...
bitnami/mariadb-cluster 1.0.2 10.2.14 DEPRECATED Chart to create a Highly available M...
bitnami/mariadb-galera 7.1.0 10.6.7 MariaDB Galera is a multi-primary database clus...
stable/gcloud-sqlproxy 0.2.3 Google Cloud SQL Proxy
stable/mariadb 2.1.6 10.1.31 Fast, reliable, scalable, and easy to use open-...
导出最新配置模版 values.yaml
helm show values bitnami/mysql > values.yaml
修改模版
原配项 | 原值 | 修改值 | 说明 |
---|---|---|---|
global.storageClass | "" | “csi-rbd-sc” | k8s集群已有的StorageClass |
image.debug | false | true | 打开日志 |
architecture | standalone | replication | 主从复制模式 |
secondary.replicaCount | 1 | 2 | 从节点数量 |
安装mysql
helm install mysql8 bitnami/mysql -f values.yaml