This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.4.3. 使用 Azure File 的持久性存储
OpenShift Container Platform 支持 Microsoft Azure File 卷。您可以使用 Azure 为 OpenShift Container Platform 集群置备永久性存储。我们假设您对 Kubernetes 和 Azure 有一定的了解。
Kubernetes 持久性卷框架允许管理员提供带有持久性存储的集群,并使用户可以在不了解底层存储架构的情况下请求这些资源。您可以动态置备 Azure File 卷。
持久性卷不绑定到单个项目或命名空间,您可以在 OpenShift Container Platform 集群中共享它们。持久性卷声明是针对某个项目或命名空间的,应用程序中可以请求它的用户。
存储的高可用性功能由底层的存储架构提供。
Azure File 卷使用服务器消息块。
4.3.1. 创建 Azure File 共享持久性卷声明 复制链接链接已复制到粘贴板!
要创建持久性卷声明,您必须首先定义一个包含 Azure 帐户和密钥的 Secret
对象。此 secret 在 PersistentVolume
定义中使用,应用程序中使用的持久性卷声明将引用该 secret。
先决条件
- 已存在 Azure File 共享。
- 有访问此共享所需的凭证,特别是存储帐户和密钥。
流程
创建包含 Azure File 凭证的
Secret
对象:oc create secret generic <secret-name> --from-literal=azurestorageaccountname=<storage-account> \ --from-literal=azurestorageaccountkey=<storage-account-key>
$ oc create secret generic <secret-name> --from-literal=azurestorageaccountname=<storage-account> \
1 --from-literal=azurestorageaccountkey=<storage-account-key>
2 Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建引用您创建的
Secret
对象的PersistentVolume
对象:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 创建映射到您创建的持久性卷的
PersistentVolumeClaim
对象:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3.2. 在 pod 中挂载 Azure File 共享 复制链接链接已复制到粘贴板!
创建持久性卷声明后,应用程序就可以使用它。以下示例演示了在 pod 中挂载此共享。
先决条件
- 已存在一个映射到底层 Azure File 共享的持久性卷声明。