如何在DigitalOcean Kubernetes上使用NFS设置ReadWriteMany(RWX)持久卷

本文档介绍了如何在DigitalOcean Kubernetes (DOKS) 集群上使用NFS服务器实现ReadWriteMany (RWX) 持久卷。首先,通过Helm部署NFS服务器,然后使用共享的PersistentVolumeClaim (PVC) 部署多实例应用,并验证NFS数据共享。教程特别强调,虽然DOKS默认的Block Storage CSI不支持多挂载,但通过NFS可以实现在多个节点间共享存储。
摘要由CSDN通过智能技术生成

介绍 (Introduction)

With the distributed and dynamic nature of containers, managing and configuring storage statically has become a difficult problem on Kubernetes, with workloads now being able to move from one Virtual Machine (VM) to another in a matter of seconds. To address this, Kubernetes manages volumes with a system of Persistent Volumes (PV), API objects that represent a storage configuration/volume, and PersistentVolumeClaims (PVC), a request for storage to be satisfied by a Persistent Volume. Additionally, Container Storage Interface (CSI) drivers can help automate and manage the handling and provisioning of storage for containerized workloads. These drivers are responsible for provisioning, mounting, unmounting, removing, and snapshotting volumes.

由于容器具有分布式和动态的特性,因此静态管理和配置存储已成为Kubernetes上的难题,现在工作负载可以在几秒钟内从一个虚拟机(VM)迁移到另一个虚拟机(VM)。 为了解决这个问题,Kubernetes使用Persistent Volumes(PV) ,代表存储配置/卷的API对象和PersistentVolumeClaims(PVC)的系统来管理卷, PersistentVolumeClaims(PVC)是由Persistent Volume满足的存储请求。 此外, 容器存储接口(CSI)驱动程序可以帮助自动化和管理容器化工作负载的存储处理和供应。 这些驱动程序负责配置,安装,卸载,删除和快照卷。

The digitalocean-csi integrates a Kubernetes cluster with the DigitalOcean Block Storage product. A developer can use this to dynamically provision Block Storage volumes for containerized applications in Kubernetes. However, applications can sometimes require data to be persisted and shared across multiple Droplets. DigitalOcean’s default Block Storage CSI solution is unable to support mounting one block storage volume to many Droplets simultaneously. This means that this is a ReadWriteOnce (RWO) solution, since the volume is confined to one node. The Network File System (NFS) protocol, on the other hand, does support exporting the same share to many consumers. This is called ReadWriteMany (RWX), because many nodes can mount the volume as read-write. We can therefore use an NFS server within our cluster to provide storage that can leverage the reliable backing of DigitalOcean Block Storage with the flexibility of NFS shares.

digitalocean-csi将Kubernetes集群与DigitalOcean块存储产品集成在一起。 开发人员可以使用它为Kubernetes中的容器化应用程序动态配置块存储卷。 但是,应用程序有时可能需要在多个Droplet之间保留和共享数据。 DigitalOcean的默认块存储CSI解决方案无法支持将一个块存储卷同时安装到许多Droplet。 这意味着这是一个ReadWriteOnce (RWO)解决方案,因为该卷仅限于一个节点。 另一方面, 网络文件系统(NFS)协议确实支持将相同的共享导出到许多使用者。 这称为ReadWriteMany (RWX),因为许多节点可以将卷作为读写装载。 因此,我们可以在群集中使用NFS服务器来提供存储,该存储可以利用DigitalOcean块存储的可靠支持和NFS共享的灵活性。

In this tutorial, you will configure dynamic provisioning for NFS volumes within a DigitalOcean Kubernetes (DOKS) cluster in which the exports are stored on DigitalOcean Block storage volumes. You will then deploy multiple instances of a demo Nginx application and test the data sharing between each instance.

在本教程中,您将为DigitalOcean Kubernetes(DOKS)集群中的NFS卷配置动态配置,其中导出存储在DigitalOcean Block存储卷上。 然后,您将部署一个演示Nginx应用程序的多个实例,并测试每个实例之间的数据共享。

Note: The deployment of nfs-server described in this tutorial is not highly available, and therefore is not recommended for use in production. Instead, the setup described is meant as a lighter weight option for development or in order to test ReadWriteMany (RWX) Persistent Volumes for educational purposes.

注意:本教程中描述的nfs-server部署不是高度可用,因此不建议在生产环境中使用。 取而代之的是,所描述的设置是为开发目的或为了教育目的而测试ReadWriteMany(RWX)持久卷的较轻量级选项。

先决条件 (Prerequisites)

Before you begin this guide you’ll need the following:

在开始本指南之前,您需要满足以下条件:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值