You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# NFS
|
|
|
|
|
|
|
|
|
|
|
|
利用 k8s 部署 NFS 存储服务
|
|
|
|
|
|
|
|
## 没有 `NFS` 服务
|
|
|
|
|
|
|
|
使用 `server-and-client` 目录中的文件部署nfs 服务
|
|
|
|
|
|
|
|
需要注意根据实际数据持久化的节点,修改 `statefulset.yaml` 下面位置
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
nodeSelector:
|
|
|
|
kubernetes.io/hostname: test-n3
|
|
|
|
volumes:
|
|
|
|
- name: export-volume
|
|
|
|
hostPath:
|
|
|
|
path: /srv
|
|
|
|
```
|
|
|
|
|
|
|
|
`read-pod.yaml` 和 `write-pod.yaml` 是用来测试服务是否搭建成功的。
|
|
|
|
|
|
|
|
## 已经存在 `NFS` 服务
|
|
|
|
|
|
|
|
已经存在外部 `NFS` 如果 `k8s` 需要 持久化使用已存在的 `NFS`,使用 `client-only` 中的文件部署,`nfs provisioner`
|
|
|
|
|
|
|
|
需要注意根据实际 NFS 的服务和 export 的目录,修改 `deployment.yaml` 下面位置
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
volumeMounts:
|
|
|
|
- name: nfs-client-root
|
|
|
|
mountPath: /persistentvolumes
|
|
|
|
env:
|
|
|
|
- name: PROVISIONER_NAME
|
|
|
|
value: k8s-sigs.io/nfs-provisioner
|
|
|
|
- name: NFS_SERVER
|
|
|
|
value: 10.8.30.152 # nfs 服务
|
|
|
|
- name: NFS_PATH
|
|
|
|
value: /data # export 的目录
|
|
|
|
volumes:
|
|
|
|
- name: nfs-client-root
|
|
|
|
nfs:
|
|
|
|
server: 10.8.30.152 # nfs 服务
|
|
|
|
path: /data # export 的目录
|
|
|
|
```
|
|
|
|
|
|
|
|
|