| conecta.sh | ||
| mysql-innodb-cluster.yaml | ||
| mysql-secrets.yaml | ||
| php-deployment.yaml | ||
| README.md | ||
| secreto.yaml | ||
MySQL Operator for Kubernetes Installation
Using Manifest Files with kubectl
First deploy the Custom Resource Definition (CRDs):
kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/9.6.0-2.2.7/deploy/deploy-crds.yaml
Then deploy MySQL Operator for Kubernetes:
kubectl apply -f https://raw.githubusercontent.com/mysql/mysql-operator/9.6.0-2.2.7/deploy/deploy-operator.yaml
Verify the operator is running by checking the deployment inside the mysql-operator namespace:
kubectl get deployment -n mysql-operator mysql-operator
NAME READY UP-TO-DATE AVAILABLE AGE
mysql-operator 1/1 1 1 1h
MySQL InnoDB Cluster Installation
Using kubectl
For creating a MySQL InnoDB Cluster, first create a secret with credentials for a MySQL root user used to perform administrative tasks in the cluster. For example:
kubectl create secret generic mypwds \
--from-literal=rootUser=root \
--from-literal=rootHost=% \
--from-literal=rootPassword="sakila"
Define your MySQL InnoDB Cluster, which references the secret. For example:
apiVersion: mysql.oracle.com/v2
kind: InnoDBCluster
metadata:
name: mycluster
spec:
secretName: mypwds
tlsUseSelfSigned: true
instances: 3
router:
instances: 1
Assuming it's saved as mycluster.yaml, deploy it:
kubectl apply -f mycluster.yaml
This sample creates an InnoDB Cluster with three MySQL Server instances and one MySQL Router instance. The process can be observed using:
kubectl get innodbcluster --watch
NAME STATUS ONLINE INSTANCES ROUTERS AGE
mycluster PENDING 0 3 1 2m6s
...
mycluster ONLINE 3 3 1 10s
Conectar al cluster
kubectl run --rm -it myshell --image=container-registry.oracle.com/mysql/community-operator -- mysqlsh
en el prompt,
\connect root@mycluster-instances.mysql-cluster.svc.cluster.local
NOTA: el nombre del host es el del servicio del cluster (
mycluster-instances) seguido del namespace (mysql-cluster) y finalmente porsvc.cluster.local.
PHP my admin
Como php my admin tiene que trabajar con el cluster, no hace falta tener uno en cada wordpress. Solo hay una instancia y está aquí