updating helm/docker files and database config files
[it/otf.git] / otf-helm / otf / charts / databases / mysqldb / templates / NOTES.txt
1 MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
2 {{ template "mysql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
3
4 {{- if .Values.existingSecret }}
5 If you have not already created the mysql password secret:
6
7    kubectl create secret generic {{ .Values.existingSecret }} --namespace {{ .Release.Namespace }} --from-file=./mysql-root-password --from-file=./mysql-password
8 {{ else }}
9
10 To get your root password run:
11
12     MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)
13 {{- end }}
14
15 To connect to your database:
16
17 1. Run an Ubuntu pod that you can use as a client:
18
19     kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il
20
21 2. Install the mysql client:
22
23     $ apt-get update && apt-get install mysql-client -y
24
25 3. Connect using the mysql cli, then provide your password:
26     $ mysql -h {{ template "mysql.fullname" . }} -p
27
28 To connect to your database directly from outside the K8s cluster:
29     {{- if contains "NodePort" .Values.service.type }}
30     MYSQL_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}')
31     MYSQL_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}')
32
33     {{- else if contains "ClusterIP" .Values.service.type }}
34     MYSQL_HOST=127.0.0.1
35     MYSQL_PORT={{ .Values.service.port }}
36
37     # Execute the following command to route the connection:
38     kubectl port-forward svc/{{ template "mysql.fullname" . }} {{ .Values.service.port }}
39
40     {{- end }}
41
42     mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}
43