Access Modes
Introduction
01Cloud provides two primary storage access modes, RWO (ReadWriteOnce) and RWX (ReadWriteMany), for managing storage in Kubernetes environments. RWO allows for exclusive access to storage by a single node, while RWX enables shared access across multiple nodes. This documentation guides you through configuring these access modes for your application, and explains the considerations for specific use cases. Prerequisites
Before configuring storage access modes, ensure that the OpenEBS package is installed in your Kubernetes cluster. OpenEBS is a critical component for enabling RWX access. If it's not already installed, please refer to the OpenEBS documentation for installation instructions.
Consequences of RWO and RWX Access Modes in 01Cloud
RWO (ReadWriteOnce) Access Mode
Exclusive Access
When you have RWO access mode enabled, storage resources are accessible exclusively by a single node within your Kubernetes cluster. This mode ensures data integrity and security for workloads that require exclusive write access. It's well-suited for applications that can operate effectively with data isolation on a per-node basis.
Limitation on Scaling
The main consequence of RWO is its limitation on scaling. In an RWO-enabled environment, pods from multiple nodes cannot simultaneously access the same storage volume. If you plan to scale your application horizontally across multiple nodes, you may encounter issues with data sharing and accessibility. As a result, RWO is not recommended for applications that require scaling across nodes.
RWX (ReadWriteMany) Access Mode
Shared Access for Scaling
RWX access mode, on the other hand, enables shared access to storage across multiple nodes within your Kubernetes cluster. Multiple pods can read from and write to the same storage concurrently. This access mode is vital for applications that require horizontal scaling, auto-scaling, or high availability across nodes.
Consequence for Database and Stateful Workloads
While RWX is excellent for many use cases, it may not be suitable for certain scenarios where data security and isolation are paramount. Specifically, for databases or stateful workloads, allowing multiple pods to simultaneously write to the same storage volume may introduce data consistency and security concerns. Therefore, for security reasons, RWX is generally not recommended for such workloads.
Considerations for Choosing Access Modes
When configuring storage access modes in 01Cloud, consider the following:
1. Application Requirements
Assess the specific needs of your application. If it requires exclusive access for data integrity, RWO is appropriate. If you need scaling capabilities, RWX is the better choice.
2. Scaling Requirements
If you anticipate your application needing to scale horizontally or automatically across multiple nodes, ensure RWX access is enabled to prevent data access restrictions.
3. Database and Stateful Workloads
For database or stateful workloads, prioritize data integrity and security. RWO access mode is often the safer choice to maintain data consistency.
4. OpenEBS Package To enable RWX access in your Kubernetes cluster, ensure that the OpenEBS package is installed. OpenEBS provides the necessary components for shared storage configurations.
By carefully considering the implications of RWO and RWX access modes in your 01Cloud environment, you can make informed decisions that align with your application's specific requirements and scaling ambitions.
Enabling RWX Access Mode for Scaling
For scenarios where you need to scale your application across multiple nodes, RWX access mode is essential. This allows multiple pods to access the same storage concurrently.
Step 1: Enable "Enable Network File System" Toggle (Template Environment)
In the template environment, enable the "Enable Network File System" toggle when creating a PVC. This will configure the PVC with RWX access, facilitating scaling across nodes. Deploy your pods using the PVC with RWX access.
Step 2: Enabling RWX Access Mode (Custom Environment)
- Navigate to the "Settings" tab and the "Storage" section.
- When creating new storage, click on the "Type" dropdown and select the "RWX" option. This will configure the PVC with RWX access.
- Deploy your pods using the PVC with RWX access.
Note on Database or Stateful Sets
For security reasons, RWX access mode is not recommended for databases or stateful sets. These workloads typically require RWO access to maintain data integrity and security.