NFS PersistentVolume - 每天5分钟玩转 Docker 容器技术(151)
上一节我们介绍了 PV 和 PVC,本节通过 NFS 实践。 作为准备工作,我们已经在 k8s-master 节点上搭建了一个 NFS 服务器,目录为/nfsdata: 下面创建一个 PVmypv1,配置文件nfs-pv1.yml如下: ①capacity指定 PV 的容量为 1G。 ②accessModes指定访问模式为ReadWriteOnce,支持的访问模式有: ReadWriteOnce – PV 能以 read-write 模式 mount 到单个节点。 ReadOnlyMany – PV 能以 read-only 模式 mount 到多个节点。 ReadWriteMany – PV 能以 read-write 模式 mount 到多个节点。 ③persistentVolumeReclaimPolicy指定当 PV 的回收策略为Recycle,支持的策略有: Retain – 需要管理员手工回收。 Recycle – 清除 PV 中的数据,效果相当于执行rm -rf /thevolume/*。 Delete – 删除 Storage Provider 上的对应存储资源,例如 ...