The cluster is comprised of {{ .Values.replicaCount }} pods: 1 leader and {{ sub .Values.replicaCount 1 }} followers. Each instance is accessible within the cluster through:

    <pod-name>.{{ template "fullname" . }}

To connect to your database:

1. Get mysql user `{{ .Values.mysql.mysqlUser}}`'s password:

    kubectl get secret -n {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.mysql-password}" | base64 --decode; echo

2. Run an Ubuntu pod that you can use as a client:

    kubectl run ubuntu -n {{ .Release.Namespace }} --image=ubuntu:focal -it --rm --restart='Never' -- bash -il

3. Install the mysql client:

    apt-get update && apt-get install mysql-client -y

4. To connect to leader service in the Ubuntu pod:

    mysql -h {{ template "fullname" . }}-leader -u {{ .Values.mysql.mysqlUser }} -p

{{- if lt 1 (.Values.replicaCount | int64) }}

5. To connect to follower service (read-only) in the Ubuntu pod:

    mysql -h {{ template "fullname" . }}-follower -u {{ .Values.mysql.mysqlUser }} -p

{{- end }}
