背景说明
Helm可以结合远程仓库对应用进行一键部署
解决方案
应用搜索
[root@cka-master helm]# helm search repo mysql
NAME CHART VERSION APP VERSION DESCRIPTION
apphub/mysql 6.8.0 8.0.19 Chart to create a Highly available MySQL cluster
apphub/mysqldump 2.6.0 2.4.1 A Helm chart to help backup MySQL databases usi...
apphub/mysqlha 1.0.0 5.7.13 MySQL cluster with a single master and zero or ...
apphub/prometheus-mysql-exporter 0.5.2 v0.11.0 A Helm chart for prometheus mysql exporter with...
github/mysql 1.6.8 5.7.30 Fast, reliable, scalable, and easy to use open-...
github/mysqldump 2.6.2 2.4.1 DEPRECATED! - A Helm chart to help backup MySQL...
github/prometheus-mysql-exporter 0.7.1 v0.11.0 DEPRECATED A Helm chart for prometheus mysql ex...
apphub/percona 1.2.0 5.7.17 free, fully compatible, enhanced, open source d...
apphub/percona-xtradb-cluster 1.0.3 5.7.19 free, fully compatible, enhanced, open source d...
apphub/phpmyadmin 4.2.12 5.0.1 phpMyAdmin is an mysql administration frontend
github/percona 1.2.2 5.7.26 free, fully compatible, enhanced, open source d...
github/percona-xtradb-cluster 1.0.7 5.7.19 free, fully compatible, enhanced, open source d...
github/phpmyadmin 4.3.5 5.0.1 DEPRECATED phpMyAdmin is an mysql administratio...
apphub/mariadb 7.3.9 10.3.22 Fast, reliable, scalable, and easy to use open-...
apphub/mariadb-galera 0.8.1 10.4.12 MariaDB Galera is a multi-master database clust...
github/gcloud-sqlproxy 0.6.1 1.11 DEPRECATED Google Cloud SQL Proxy
github/mariadb 7.3.14 10.3.22 DEPRECATED Fast, reliable, scalable, and easy t...
应用安装
[root@cka-master helm]# helm install mysql apphub/mysql
NAME: mysql
LAST DEPLOYED: Tue Mar 15 15:17:18 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Please be patient while the chart is being deployed
Tip:
Watch the deployment status using the command: kubectl get pods -w --namespace default
Services:
echo Master: mysql.default.svc.cluster.local:3306
echo Slave: mysql-slave.default.svc.cluster.local:3306
Administrator credentials:
echo Username: root
echo Password : $(kubectl get secret --namespace default mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
To connect to your database:
1. 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.19-debian-10-r0 --namespace default --command -- bash
2. To connect to master service (read/write):
mysql -h mysql.default.svc.cluster.local -uroot -p my_database
3. To connect to slave service (read-only):
mysql -h mysql-slave.default.svc.cluster.local -uroot -p my_database
To upgrade this helm chart:
1. 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 default mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode)
helm upgrade mysql bitnami/mysql --set root.password=$ROOT_PASSWORD
应用列表
[root@cka-master helm]# helm list
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mysql default 1 2022-03-15 15:17:18.165166396 +0800 CST deployed mysql-6.8.0 8.0.19
[root@cka-master helm]#
[root@cka-master helm]# helm ls
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
mysql default 1 2022-03-15 15:17:18.165166396 +0800 CST deployed mysql-6.8.0 8.0.19
[root@cka-master helm]#
应用状态
[root@cka-master helm]# helm status mysql
[root@cka-master helm]# kubectl get pod
NAME READY STATUS RESTARTS AGE
myapp 1/1 Running 0 34h
mysql-master-0 0/1 Pending 0 6m10s
mysql-slave-0 0/1 Pending 0 6m10s
[root@cka-master helm]#