openshift3.11使用nfs-client-provisioner+UCloud-UFS提供动态pv存储
在UCloud创建 NFS 协议的UFS文件系统
创建UFS挂载点,挂载点地址为:172.16.16.137:/
准备部署使用的yaml
rbac.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-nfs-client-provisioner
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: ClusterRole
name: nfs-client-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
subjects:
- kind: ServiceAccount
name: nfs-client-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: Role
name: leader-locking-nfs-client-provisioner
apiGroup: rbac.authorization.k8s.ionfs-client-provisioner.yaml
其中NFS_SERVER 为 172.16.16.137, UFS 的 nfs接口不支持 nfs-client-provisioner 默认的挂载参数 ,所有需要手动 nfs-client-provisioner 使用的pvc和pv 配和nfs-client-provisioner发布
storageclass.yaml
部署
所有需要挂载nfs的宿主机开放selinux pod 挂载nfs权限
参考:
https://liujinye.gitbook.io/openshift-docs/storage/openshift3.11-shi-yong-nfsclientprovisioner+ali-yun-nas-ti-gong-dong-tai-nfs
https://docs.ucloud.cn/uk8s/volume/dynamic_ufs
Last updated