# % _____ %%% | __ \ ###%%%%%%%%%%%%* | |__) |__ _ __ ___ ___ _ __ __ _ ### ##%% %%%% | ___/ _ \ '__/ __/ _ \| '_ \ / _` | #### ##% %%%% | | | __/ | | (_| (_) | | | | (_| | ### #### %%% |_| \___|_| \___\___/|_| |_|\__,_| ,((### ### %%% _ _ _____ _ (((( (### #### %%%% | | / _ \ / ____| | | ((( ((# ###### | | _| (_) |___ | (___ __ _ _ _ __ _ __| | (((( (((# #### | |/ /> _ >> https://percona.com/k8s <<< 1. To get a MySQL prompt inside your new cluster you can run: {{- if hasKey .Values.pxc "clusterSecretName" }} ROOT_PASSWORD=`kubectl -n {{ .Release.Namespace }} get secrets {{ .Values.pxc.clusterSecretName }} -o jsonpath="{.data.root}" | base64 --decode` kubectl -n {{ .Release.Namespace }} exec -ti \ {{ include "pxc-database.fullname" . }}-pxc-0 -c pxc -- mysql -uroot -p"$ROOT_PASSWORD" {{- else }} ROOT_PASSWORD=`kubectl -n {{ .Release.Namespace }} get secrets {{ include "pxc-database.fullname" . }}-secrets -o jsonpath="{.data.root}" | base64 --decode` kubectl -n {{ .Release.Namespace }} exec -ti \ {{ include "pxc-database.fullname" . }}-pxc-0 -c pxc -- mysql -uroot -p"$ROOT_PASSWORD" {{- end }} 2. To connect an Application running in the same Kubernetes cluster you can connect with: {{- if hasKey .Values.pxc "clusterSecretName" }} ROOT_PASSWORD=`kubectl -n {{ .Release.Namespace }} get secrets {{ .Values.pxc.clusterSecretName }} -o jsonpath="{.data.root}" | base64 --decode` {{- else }} ROOT_PASSWORD=`kubectl -n {{ .Release.Namespace }} get secrets {{ include "pxc-database.fullname" . }}-secrets -o jsonpath="{.data.root}" | base64 --decode` {{- end }} {{- if .Values.proxysql.enabled }} kubectl run -i --tty --rm percona-client --image=percona --restart=Never \ -- mysql -h {{ template "pxc-database.fullname" . }}-proxysql.{{ .Release.Namespace }}.svc.cluster.local -uroot -p"$ROOT_PASSWORD" {{- else }} kubectl run -i --tty --rm percona-client --image=percona --restart=Never \ -- mysql -h {{ template "pxc-database.fullname" . }}-haproxy.{{ .Release.Namespace }}.svc.cluster.local -uroot -p"$ROOT_PASSWORD" {{- end }}