github.com/alibaba/sealer@v0.8.6-0.20220430115802-37a2bdaa8173/applications/mysql/README.md (about)

     1  # Overview
     2  
     3  This image chooses OpenEBS Jiva as its persistence storage engine.
     4  
     5  Components included in this image:
     6  
     7  * 1 StatefulSet replica for mysql primary which requests "80Gi" storage.
     8  * 1 StatefulSet replica for mysql secondary which requests "80Gi" storage.
     9  
    10  ## How to use it
    11  
    12  Tip:
    13  
    14  Watch the deployment status using the command: kubectl get pods -w --namespace mysql-system
    15  
    16  Services:
    17  
    18  echo Primary: my-mysql-primary.mysql-system.svc.cluster.local:3306 echo Secondary:
    19  my-mysql-secondary.mysql-system.svc.cluster.local:3306
    20  
    21  Administrator credentials:
    22  
    23  echo Username: root echo Password : $(kubectl get secret --namespace mysql-system my-mysql -o jsonpath="
    24  {.data.mysql-root-password}" | base64 --decode)
    25  
    26  To connect to your database:
    27  
    28  1. Run a pod that you can use as a client:
    29  
    30     kubectl run my-mysql-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mysql:8.0.26-debian-10-r10
    31     --namespace mysql-system --command -- bash
    32  
    33  2. To connect to primary service (read/write):
    34  
    35     mysql -h my-mysql-primary.mysql-system.svc.cluster.local -uroot -p my_database
    36  
    37  3. To connect to secondary service (read-only):
    38  
    39     mysql -h my-mysql-secondary.mysql-system.svc.cluster.local -uroot -p my_database
    40  
    41  ## How to rebuild it use helm
    42  
    43  Kubefile:
    44  
    45  ```shell
    46  FROM registry.cn-qingdao.aliyuncs.com/sealer-apps/openebs-jiva:2.11.0
    47  # add helm repo and run helm install
    48  RUN helm repo add bitnami https://charts.bitnami.com/bitnami
    49  # set persistence.storageClass=openebs-jiva-csi-sc, which is provided by base image openebs-jiva:2.11.0.
    50  CMD helm install my-mysql --set architecture=replication --create-namespace --namespace mysql-system --set secondary.persistence.storageClass=openebs-jiva-csi-sc --set primary.persistence.storageClass=openebs-jiva-csi-sc --set secondary.replicaCount=1 bitnami/mysql --version 8.8.6
    51  ```
    52  
    53  run below command to build it
    54  
    55  ```shell
    56  sealer build -t {Your Image Name} -f Kubefile -m cloud .
    57  ```
    58  
    59  More parameters see [officail document here](https://artifacthub.io/packages/helm/bitnami/mysql).