一、搜索mysql8版本
# helm search repo mysql# helm pull bitnami/mysql --version:11.1.2# tar -zxf mysql-11.1.2.tgz# cd mysql
二、修改value.ysqml文件
动态存储类自己提前搭建。
# helm install mysql8 -n mysql-cluster ./ -f values.yaml
NAME: mysql8
LAST DEPLOYED: Thu Jul 11 21:47:23 2024
NAMESPACE: mysql-cluster
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: mysql
CHART VERSION: 11.1.2
APP VERSION: 8.4.0** Please be patient while the chart is being deployed **Tip:Watch the deployment status using the command: kubectl get pods -w --namespace mysql-clusterServices:echo Primary: mysql8-primary.mysql-cluster.svc.cluster.local:3306echo Secondary: mysql8-secondary.mysql-cluster.svc.cluster.local:3306Execute the following to get the administrator credentials:echo Username: rootMYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace mysql-cluster mysql8 -o jsonpath="{.data.mysql-root-password}" | base64 -d)To connect to your database:1. Run a pod that you can use as a client:kubectl run mysql8-client --rm --tty -i --restart='Never' --image dhub.kubesre.xyz/bitnami/mysql:8.4.0-debian-12-r3 --namespace mysql-cluster --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash2. To connect to primary service (read/write):mysql -h mysql8-primary.mysql-cluster.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"3. To connect to secondary service (read-only):mysql -h mysql8-secondary.mysql-cluster.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"WARNING: There are "resources" sections in the chart not set. Using "resourcesPreset" is not recommended for production. For production installations, please set the following values according to your workload needs:- primary.resources- secondary.resources
+info https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/⚠ SECURITY WARNING: Original containers have been substituted. This Helm chart was designed, tested, and validated on multiple platforms using a specific set of Bitnami and Tanzu Application Catalog containers. Substituting other containers is likely to cause degraded security and performance, broken chart features, and missing environment variables.Substituted images detected:- dhub.kubesre.xyz/bitnami/mysql:8.4.0-debian-12-r3- dhub.kubesre.xyz/bitnami/os-shell:12-debian-12-r22- dhub.kubesre.xyz/bitnami/mysqld-exporter:0.15.1-debian-12-r17
三、检查及测试
登录master:
登录备库: