57 lines
3.0 KiB
Plaintext
57 lines
3.0 KiB
Plaintext
#
|
|
|
|
% _____
|
|
%%% | __ \
|
|
###%%%%%%%%%%%%* | |__) |__ _ __ ___ ___ _ __ __ _
|
|
### ##%% %%%% | ___/ _ \ '__/ __/ _ \| '_ \ / _` |
|
|
#### ##% %%%% | | | __/ | | (_| (_) | | | | (_| |
|
|
### #### %%% |_| \___|_| \___\___/|_| |_|\__,_|
|
|
,((### ### %%% _ _ _____ _
|
|
(((( (### #### %%%% | | / _ \ / ____| | |
|
|
((( ((# ###### | | _| (_) |___ | (___ __ _ _ _ __ _ __| |
|
|
(((( (((# #### | |/ /> _ </ __| \___ \ / _` | | | |/ _` |/ _` |
|
|
/(( ,((( *### | <| (_) \__ \ ____) | (_| | |_| | (_| | (_| |
|
|
//// ((( #### |_|\_\\___/|___/ |_____/ \__, |\__,_|\__,_|\__,_|
|
|
/// (((( #### | |
|
|
/////////////(((((((((((((((((######## |_| Join @ percona.com/k8s
|
|
|
|
|
|
Join Percona Squad! Get early access to new product features, invite-only ”ask me anything” sessions with Percona Kubernetes experts, and monthly swag raffles.
|
|
|
|
>>> 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 }}
|
|
|