本文采用网上镜像:mirrorgooglecontainers/kubernetes-zookeeper:1.0-3.4.10
准备共享存储:nfs,glusterfs,seaweed或其他,并在node节点挂载
本次采用seaweed分布式文件系统
node节点挂载:
./weed mount -filer=192.168.11.103:8801 -dir=/data/ -filer.path=/ &
[root@k8s-master sts]# kubectl get nodes -o wide NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME k8s-master Ready master 97d v1.15.0 192.168.10.171 <none> CentOS Linux 7 (Core) 3.10.0-862.el7.x86_64 docker://19.3.1 k8s-node1 Ready node 97d v1.15.0 192.168.11.63 <none> CentOS Linux 7 (Core) 3.10.0-862.el7.x86_64 docker://19.3.1 [root@k8s-master sts]#
创建pv
使用本地目录创建pv, 确定node节点已经挂载共享存储..使用本地目录也可以
[root@k8s-master sts]# cat zk-pv.yaml kind: PersistentVolume apiVersion: v1 metadata: name: pv-zk1 namespace: bigdata annotations: volume.beta.kubernetes.io/storage-class: "anything" labels: type: local spec: capacity: storage: 3Gi accessModes: - ReadWriteOnce hostPath: path: "/data/zookeeper1" persistentVolumeReclaimPolicy: Recycle --- kind: PersistentVolume apiVersion: v1 metadata: name: pv-zk2 namespace: bigdata annotations: volume.beta.kubernetes.io/storage-class: "anything" labels: type: local spec: capacity: storage: 3Gi accessModes: - ReadWriteOnce hostPath: path: "/data/zookeeper2" persistentVolumeReclaimPolicy: Recycle --- kind: PersistentVolume apiVersion: v1 metadata: name: pv-zk3 namespace: bigdata annotations: volume.beta.kubernetes.io/storage-class: "anything" labels: type: local spec: capacity: storage: 3Gi accessModes: - ReadWriteOnce hostPath: path: "/data/zookeeper3" persistentVolumeReclaimPolicy: Recycle [root@k8s-master sts]#