# 使用 Helm Stable Charts $ helm repo add helm-stable-charts https://kubernetes-charts.storage.googleapis.com/ "helm-stable-charts" has been added to your repositories
# 使用 Helm Incubartor Charts $ helm repo add helm-incubator-charts https://kubernetes-charts-incubator.storage.googleapis.com "helm-incubator-charts" has been added to your repositories
# Update charts from these repos $ helm repo update Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "helm-incubator-charts" chart repository ...Successfully got an update from the "helm-stable-charts" chart repository Update Complete. ⎈ Happy Helming!⎈
# Search charts # helm search repo <name> $ helm search repo mysql NAME CHART VERSION APP VERSION DESCRIPTION helm-incubator-charts/mysqlha 2.0.0 5.7.13 MySQL cluster with a single master and zero or ... helm-stable-charts/mysql 1.6.3 5.7.28 Fast, reliable, scalable, and easy to use open-... helm-stable-charts/mysqldump 2.6.0 2.4.1 A Helm chart to help backup MySQL databases usi... helm-stable-charts/prometheus-mysql-exporter 0.5.2 v0.11.0 A Helm chart for prometheus mysql exporter with... helm-stable-charts/percona 1.2.1 5.7.26 free, fully compatible, enhanced, open source d... helm-stable-charts/percona-xtradb-cluster 1.0.3 5.7.19 free, fully compatible, enhanced, open source d... helm-stable-charts/phpmyadmin 4.3.5 5.0.1 DEPRECATED phpMyAdmin is an mysql administratio... helm-stable-charts/gcloud-sqlproxy 0.6.1 1.11 DEPRECATED Google Cloud SQL Proxy helm-stable-charts/mariadb 7.3.14 10.3.22 DEPRECATED Fast, reliable, scalable, and easy t...
# Create a new project - test-mariadb $ oc new-project test-mysql Now using project "test-mysql" on server "https://api.ocp4.internal:6443".
# Install charts - mysql $ helm install mysql-dev helm-stable-charts/mysql NAME: mysql-dev LAST DEPLOYED: Sun Apr 26 18:27:10 2020 NAMESPACE: test-mysql STATUS: deployed REVISION: 1 NOTES: MySQL can be accessed via port 3306 on the following DNS name from within your cluster: mysql-dev.test-mysql.svc.cluster.local
3. Connect using the mysql cli, then provide your password: $ mysql -h mysql-dev -p
To connect to your database directly from outside the K8s cluster: MYSQL_HOST=127.0.0.1 MYSQL_PORT=3306
# Execute the following command to route the connection: kubectl port-forward svc/mysql-dev 3306
mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}
# Check Charts list $ helm list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION mysql-dev test-mysql 1 2020-04-26 18:27:10.979294793 +0800 CST deployed mysql-1.6.3 5.7.28
# Check Mysql server is ready $ oc get all NAME READY STATUS RESTARTS AGE pod/mysql-dev-d8b597f5f-b2nxn 1/1 Running 0 31s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/mysql-dev ClusterIP 172.30.4.152 <none> 3306/TCP 31s
NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/mysql-dev 1/1 1 1 31s
NAME DESIRED CURRENT READY AGE replicaset.apps/mysql-dev-d8b597f5f 1 1 1 31s
# Create a new project - test-mariadb $ oc new-project test-my-first-helm-chart Now using project "test-my-first-helm-chart" on server "https://api.ocp4.internal:6443".
# Install guestbook using helm 3 $ cd helm101/charts $ helm install guestbook-demo ./guestbook/ --namespace test-my-first-helm-chart
# Check Charts list $ helm list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION guestbook-demo test-my-first-helm-chart 1 2020-04-26 18:45:34.084900528 +0800 CST deployed guestbook-0.2.0
# Check Guestbook server is ready $ oc get all NAME READY STATUS RESTARTS AGE pod/guestbook-demo-67f5b45d45-kscnt 1/1 Running 0 2m39s pod/guestbook-demo-67f5b45d45-tv4dr 1/1 Running 0 2m39s pod/redis-master-68857cd57c-7m585 1/1 Running 0 2m39s pod/redis-slave-bbd8d8545-6nwh5 1/1 Running 0 2m39s pod/redis-slave-bbd8d8545-xgkmb 1/1 Running 0 2m39s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/guestbook-demo LoadBalancer 172.30.216.24 <pending> 3000:32765/TCP 2m39s service/redis-master ClusterIP 172.30.64.237 <none> 6379/TCP 2m39s service/redis-slave ClusterIP 172.30.143.221 <none> 6379/TCP 2m39s
NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/guestbook-demo 2/2 2 2 2m39s deployment.apps/redis-master 1/1 1 1 2m39s deployment.apps/redis-slave 2/2 2 2 2m39s
NAME DESIRED CURRENT READY AGE replicaset.apps/guestbook-demo-67f5b45d45 2 2 2 2m39s replicaset.apps/redis-master-68857cd57c 1 1 1 2m39s replicaset.apps/redis-slave-bbd8d8545 2 2 2 2m39s