简介:
PXC Operator由Percona基于SDK创建,文档详细,有很好的维护,是MySQL Operator很好的参考案例,这里只做简单的部署实验。详细信息查看官方文档:
# 下载代码 git clone -b v1.9.0 https://github.com/percona/percona-xtradb-cluster-operator cd percona-xtradb-cluster-operator kubectl apply -f deploy/crd.yaml kubectl create namespace pxc kubectl config set-context $(kubectl config current-context) --namespace=pxc kubectl apply -f deploy/rbac.yaml kubectl apply -f deploy/operator.yaml
2、部署PXC
kubectl create -f deploy/secrets.yaml
cp deploy/cr.yaml deploy/pxc.yaml
volume: persistentVolumeClaim: storageClassName: standard # 写上你自己的SC名字 accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 6G
# 如果没有SC可以自己创建三个PV做测试用,metadata.name不同就行(上面修改过SC就可以省略了) apiVersion: v1 kind: PersistentVolume metadata: name: pxc-pv-volume-0 labels: type: local spec: capacity: storage: 6Gi accessModes: - ReadWriteOnce hostPath: path: "/data/pxc"
mkdir /data/pxc chown 99:1001 /data/pxc -R chmod 775 /data/pxc -R 注意:按理说,这里不用创建目录并且赋予权限,可是如果不提前加的话,pxc-init初始化容器 会报install: cannot create regular file '/var/lib/mysql/pxc-entrypoint.sh': Permission denied
kubectl apply -f deploy/pxc.yaml