X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=it%2Fotf.git;a=blobdiff_plain;f=otf-helm%2Fotf%2Fcharts%2Fdatabases%2Fmysqldb%2Ftemplates%2FNOTES.txt;fp=otf-helm%2Fotf%2Fcharts%2Fdatabases%2Fmysqldb%2Ftemplates%2FNOTES.txt;h=d33753aa93c9009a8d1967c67fdc9e53fb8e9052;hp=0000000000000000000000000000000000000000;hb=321c6b595a3f05db9e4327c16af85c16752f9ec2;hpb=29cd8447ada8036b91ad2ca75a3c1c3fe0d8ba55 diff --git a/otf-helm/otf/charts/databases/mysqldb/templates/NOTES.txt b/otf-helm/otf/charts/databases/mysqldb/templates/NOTES.txt new file mode 100644 index 0000000..d33753a --- /dev/null +++ b/otf-helm/otf/charts/databases/mysqldb/templates/NOTES.txt @@ -0,0 +1,43 @@ +MySQL can be accessed via port 3306 on the following DNS name from within your cluster: +{{ template "mysql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +{{- if .Values.existingSecret }} +If you have not already created the mysql password secret: + + kubectl create secret generic {{ .Values.existingSecret }} --namespace {{ .Release.Namespace }} --from-file=./mysql-root-password --from-file=./mysql-password +{{ else }} + +To get your root password run: + + MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) +{{- end }} + +To connect to your database: + +1. Run an Ubuntu pod that you can use as a client: + + kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il + +2. Install the mysql client: + + $ apt-get update && apt-get install mysql-client -y + +3. Connect using the mysql cli, then provide your password: + $ mysql -h {{ template "mysql.fullname" . }} -p + +To connect to your database directly from outside the K8s cluster: + {{- if contains "NodePort" .Values.service.type }} + MYSQL_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') + MYSQL_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}') + + {{- else if contains "ClusterIP" .Values.service.type }} + MYSQL_HOST=127.0.0.1 + MYSQL_PORT={{ .Values.service.port }} + + # Execute the following command to route the connection: + kubectl port-forward svc/{{ template "mysql.fullname" . }} {{ .Values.service.port }} + + {{- end }} + + mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} +