背景说明
Helm可以结合远程仓库对应用进行一键部署
解决方案
应用搜索
[root@cka-master helm]# helm search repo mysqlNAME 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/mysqlNAME: mysqlLAST DEPLOYED: Tue Mar 15 15:17:18 2022NAMESPACE: defaultSTATUS: deployedREVISION: 1TEST SUITE: NoneNOTES:Please be patient while the chart is being deployedTip: Watch the deployment status using the command: kubectl get pods -w --namespace defaultServices: echo Master: mysql.default.svc.cluster.local:3306 echo Slave: mysql-slave.default.svc.cluster.local:3306Administrator 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_databaseTo 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 listNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSIONmysql 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 lsNAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSIONmysql 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 podNAME READY STATUS RESTARTS AGEmyapp 1/1 Running 0 34hmysql-master-0 0/1 Pending 0 6m10smysql-slave-0 0/1 Pending 0 6m10s[root@cka-master helm]#