Kubernetes applications often require persistent storage to store data. Alibaba Cloud Container Service for Kubernetes (ACK) integrates multiple Alibaba Cloud storage services—such as Elastic Block Storage (EBS), Object Storage Service (OSS), Network Attached Storage (NAS), and Cloud Parallel File Storage (CPFS)—through the standard Container Storage Interface (CSI). ACK is also compatible with native Kubernetes storage mechanisms to provide tailored storage solutions for different business scenarios.
Select a storage solution
ACK provides two types of storage solutions:
Kubernetes-native volumes: Designed for temporary data, configuration management, or node-level interaction. Their lifecycle is tied to that of a pod, and they do not support data persistence for applications.
Alibaba Cloud persistent volumes: Integrated through Container Storage Interface (CSI) components, these volumes provide stable and reliable data persistence for workloads. Their lifecycle is independent of pods and they support stateful applications.
Before you use container storage, make sure that you understand key concepts such as volume, PersistentVolume (PV), and PersistentVolumeClaim (PVC). For more information, see Storage basics.
Kubernetes-native volumes
Kubernetes-native volumes have lifecycles that are bound to pods and are not suitable for persisting application data.
Type | Description | Key feature |
emptyDir | A temporary empty directory whose lifecycle matches that of its pod. | Data is lost when the pod is deleted. Use this for inter-container data exchange or temporary caching within a pod. |
HostPath | Mounts a file or directory from the host node into a pod. You can control pre-mount checks and creation behavior using the For more information, see HostPath volumes | Data is bound to the node and does not move with the pod. Not suitable for stateful applications requiring high availability and persistence (for example, databases or caches). |
ConfigMap/Secret | Mounts configuration items or sensitive credentials as files. | Designed only for small-volume configuration data—not business data. Used to decouple configuration from applications. |
Alibaba Cloud persistent volumes
For stateful applications that require persistent data storage, you can use Alibaba Cloud persistent volumes. These volumes have lifecycles that are independent of pods and are integrated with Kubernetes using CSI.
Solution comparison
To help you select the right option quickly, each storage solution in the table below includes quick-reference icons for core attributes. For example, for EBS:
Cloud disk: Solution details. Click (view details) to view details.Static/Dynamic: The supported volume provisioning methods, including static provisioning (PV/PVC) and dynamic provisioning (StorageClass/PVC). Click the links for step-by-step instructions.
RWO: The supported access modes (
accessModes): RWO (ReadWriteOnce), RWX (ReadWriteMany), and ROX (ReadOnlyMany).Billing: Billing details. Click the link to view details.
Storage option | Description | Trade-offs and limits |
|
| |
|
| |
RWX, ROX | Billing |
|
|
|
| |
|
|
Beyond basic performance, storage options differ in operational areas such as fault recovery, capacity management, and data protection. Consider the following questions to refine your selection.
Key components and concepts
CSI components (csi-plugin, csi-provisioner)
These components are the Kubernetes community-recommended implementation for storage plugins. They are pre-installed and enabled by default in ACK clusters. The components interact with Alibaba Cloud storage APIs to manage the full lifecycle of volumes, including automatic creation, mounting, and unmounting. For more information, see Manage CSI components.
Container Network File System (CNFS)
CNFS is an enhanced storage capability that is available in ACK Pro clusters. It abstracts NAS, OSS, and CPFS as Kubernetes Custom Resource Definitions (CRDs) to enable fine-grained management, such as dynamic subdirectory creation, quota management, I/O performance monitoring, recycle bin management, and distributed caching. For more information, see Container Network File System (CNFS).
Usage notes
When you use CSI, take note of the following limits.
Cluster version: Your cluster must run Kubernetes 1.14 or later. To upgrade your cluster, see Manually upgrade a cluster.
Cluster environment: CSI is fully tested and validated in ACK clusters. For non-ACK clusters, such as clusters in non-Alibaba Cloud environments or self-managed clusters on Alibaba Cloud, CSI may not provide out-of-the-box functionality due to differences in configurations, permissions, and networking.
We recommend that you review the alibaba-cloud-csi-driver source code and adapt it to your environment.
Node configuration: The kubelet parameter
--enable-controller-attach-detachmust be set totrue.Operating system: Windows nodes are not supported.
RBAC permissions: PersistentVolumes (PVs) are cluster-scoped resources. PersistentVolumeClaims (PVCs) are namespace-scoped. When you grant RBAC permissions, take note of the different access levels that are required for these two resource types.
If the default ACK roles, such as administrator and O&M engineer, do not meet your needs, you can configure custom permissions. For example, the default O&M engineer role grants read and write access to PVCs in authorized namespaces but only read-only access to PVs across the cluster. Therefore, you cannot use this role to manually create PVs. For more information, see Grant RBAC permissions to a RAM user or RAM role.
FAQ
How do I check which storage plugin my cluster uses?
You can use one of the following methods.
Check node annotations in the ACK console
On the ACK Clusters page, click the name of your cluster. On the cluster details page, in the navigation pane on the left, click .
In the node list, find the node that you want to manage and click Details in the Actions column. On the Overview tab, view the Annotations of the node.
If
volumes.kubernetes.io/controller-managed-attach-detach: trueexists, the storage plugin is CSI. If it does not exist, the plugin is FlexVolume.
View kubelet parameters with a command
Log on to a node and check the kubelet parameters.
ps -ef | grep kubeletExpected output:
--enable-controller-attach-detach=truetrue: The storage plugin is CSI.false: The storage plugin is FlexVolume.
How do I manually grant permissions to the CSI plugin?
The CSI plugin requires permissions to access other cloud resources when it mounts, unmounts, creates, or deletes volumes. By default, CSI is installed and configured with the required permissions in ACK clusters. To manually set up permissions, perform the following steps.
Grant permissions using a RAM role (default): The CSI plugin uses the AliyunCSManagedCsiRole to access resources in other Alibaba Cloud services. For more information, see ACK service roles.
ACK managed clusters: For ACK managed clusters, the token for the RAM role that is used by CSI is stored in a Secret named addon.csi.token. You can mount this Secret to grant permissions and enable API access.
ACK dedicated clusters: For ACK dedicated clusters, CSI inherits the RAM role that is assigned to the ECS node on which its pod runs.
For more information about how to grant permissions to RAM roles, see Manage permissions for a RAM role.
Grant permissions using an AccessKey pair
Use environment variables: You can create the AccessKey pair as a Kubernetes Secret and inject it into the CSI pod as an environment variable. This prevents credentials from being exposed in plain text in deployment templates.
Use a direct YAML entry: You can embed the AccessKey pair directly in the CSI YAML file. This method is not recommended for production environments.