安装 mysql
- bitnami mysql chart
- bitnami phpmyadmin chart
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install my-release bitnami/mysql
Tip:
Watch the deployment status using the command: kubectl get pods -w --namespace data
Services:
echo Primary: mysql.data.svc.cluster.local:3306
Administrator credentials:
echo Username: root echo Password : $(kubectl get secret --namespace data mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
To connect to your database:
-
Run a pod that you can use as a client:
kubectl run mysql-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mysql:8.0.23-debian-10-r57 --namespace data --command -- bash
-
To connect to primary service (read/write):
mysql -h mysql.data.svc.cluster.local -uroot -p my_database
To upgrade this helm chart:
-
Obtain the password as described on the 'Administrator credentials' section and set the 'root.password' parameter as shown below:
ROOT_PASSWORD=$(kubectl get secret --namespace data mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode) helm upgrade mysql bitnami/mysql --set auth.rootPassword=$ROOT_PASSWORD