I tried installing mysql percona xtraDB, it installs fine but the output it generates after the helm chat installation to interact with the pods are not working.
Install steps
helm repo add percona https://percona.github.io/percona-helm-charts/
helm repo update
kubectl create ns pxc
helm install my-op percona/pxc-operator --namespace pxc
helm install my-db percona/pxc-db --namespace pxc --set pxc.volumeSpec.resources.requests.storage=20Gi --set pxc.spec.crVersion="1.11.0"
now these create outputs like below
NOTES:
1. To get a MySQL prompt inside your new cluster you can run:
ROOT_PASSWORD=`kubectl -n pxc get secrets my-db-pxc-db -o jsonpath="{.data.root}" | base64 --decode`
kubectl -n pxc exec -ti \
my-db-pxc-db-pxc-0 -- mysql -uroot -p"$ROOT_PASSWORD"
2. To connect an Application running in the same Kubernetes cluster you can connect with:
$ kubectl run -i --tty --rm percona-client --image=percona --restart=Never \
-- mysql -h my-db-pxc-db-proxysql.pxc.svc.cluster.local -uroot -p"$ROOT_PASSWORD"
Both of the above commands give error
kubectl run -i --tty --rm percona-client --image=percona --restart=Never \
-- mysql -h my-db-pxc-db-proxysql.pxc.svc.cluster.local -uroot -p"$ROOT_PASSWORD"
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2005 (HY000): Unknown MySQL server host 'my-db-pxc-db-proxysql.pxc.svc.cluster.local' (2)
pod "percona-client" deleted
pod default/percona-client terminated (Error)
above works when I change the -h to my-db-pxc-db-pxc.pxc.svc.cluster.local
another one
ROOT_PASSWORD=`kubectl -n pxc get secrets my-db-pxc-db -o jsonpath="{.data.root}" | base64 --decode`
kubectl -n pxc exec -ti \
my-db-pxc-db-pxc-0 -- mysql -uroot -p"$ROOT_PASSWORD"
Defaulted container "logs" out of: logs, logrotate, pxc, pxc-init (init)
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
above will work if I add -c pxc as the container to log into
So the helm outputs are wrong or is it something I am not doing right ?
My pods looks fine
kubectl get pods -n pxc
NAME READY STATUS RESTARTS AGE
my-op-pxc-operator-58c9bfb678-mbpgn 1/1 Running 0 77m
my-db-pxc-db-pxc-0 3/3 Running 0 77m
my-db-pxc-db-haproxy-0 2/2 Running 0 77m
my-db-pxc-db-haproxy-1 2/2 Running 0 75m
my-db-pxc-db-haproxy-2 2/2 Running 0 75m
my-db-pxc-db-pxc-1 3/3 Running 0 75m
my-db-pxc-db-pxc-2 3/3 Running 0 74m
svc
kubectl get svc -n pxc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
percona-xtradb-cluster-operator ClusterIP 10.43.44.223 <none> 443/TCP 77m
my-db-pxc-db-pxc ClusterIP None <none> 3306/TCP,33062/TCP,33060/TCP 77m
my-db-pxc-db-pxc-unready ClusterIP None <none> 3306/TCP,33062/TCP,33060/TCP 77m
my-db-pxc-db-haproxy ClusterIP 10.43.69.102 <none> 3306/TCP,3309/TCP,33062/TCP,33060/TCP 77m
my-db-pxc-db-haproxy-replicas ClusterIP 10.43.60.195 <none> 3306/TCP 77m