Kubernetes applications often require persistent storage to retain data. ACK integrates multiple Alibaba Cloud storage services (Cloud disk, OSS, NAS, and CPFS) through the Container Storage Interface (CSI), and also supports Kubernetes-native volume types. This gives you flexible storage options for both ephemeral and persistent workloads.
Storage solutions
ACK storage options fall into two categories:
Kubernetes-native volumes: Used for ephemeral data, configuration injection, or interaction with the host node. These volumes are tied to the Pod lifecycle and are not suitable for persistent application data.
Alibaba Cloud persistent volumes: Integrate with Alibaba Cloud storage services through CSI. These volumes are decoupled from the Pod lifecycle and support stateful workloads.
Before using container storage features, make sure you understand core Kubernetes storage concepts such as volumes, PersistentVolumes (PVs), and PersistentVolumeClaims (PVCs).
Kubernetes-native volumes
Kubernetes-native volumes are tied to the Pod lifecycle and are not designed for persistent data storage.
Type | Description | Key features |
emptyDir | An ephemeral volume that shares the Pod lifecycle. | Data persists only for the lifetime of the Pod. Best for inter-container sharing and ephemeral caches. |
HostPath | Mounts a file or directory from the host node into a Pod. Use the For more information, see HostPath volumes. | Data is bound to the node and does not follow Pod rescheduling. Not recommended for stateful applications that require high availability (such as databases or caches). |
ConfigMap/Secret | Mounts configuration entries or sensitive credentials as files. | Intended for small configuration data, not application data. Use it to decouple configuration from application code. |
Alibaba Cloud persistent volumes
For stateful applications that require persistent data, use persistent storage volumes backed by Alibaba Cloud storage services. These volumes exist independently of the Pod lifecycle and integrate with Kubernetes through CSI.
Comparison
The comparison table below includes a quick-reference index under each storage solution name. Using Cloud disk as an example:
Cloud disk: The storage service. Click for details.Static/Dynamic: Supported volume provisioning methods, including statically provisioned volumes (PV/PVC) and dynamically provisioned volumes (StorageClass/PVC). Click for step-by-step instructions.
RWO: Supported access modes (
accessModes): RWO (ReadWriteOnce), RWX (ReadWriteMany), and ROX (ReadOnlyMany).Billing: Pricing details. Click for details.
Storage solution | Description | Trade-offs and limitations |
|
| |
|
| |
RWX, ROX | Billing |
|
|
|
| |
|
|
Beyond baseline performance, storage solutions also differ in how they handle failure recovery, capacity management, and data protection. Consider the following questions to refine your choice.
Key add-ons and concepts
CSI add-ons(csi-plugin, csi-provisioner)
The Kubernetes-recommended storage plugin implementation, deployed by default in ACK clusters. These add-ons interact with Alibaba Cloud storage APIs to manage the volume lifecycle, including provisioning, attaching, detaching, and deletion.
Container Network File System (CNFS)
A storage enhancement available in ACK Pro clusters. CNFS represents NAS, OSS, and CPFS resources as Kubernetes Custom Resource Definitions (CRDs) and provides fine-grained management capabilities such as dynamic subdirectory creation, quota management, I/O monitoring, recycle bin management, and distributed caching.
Usage notes
Cluster version: Kubernetes 1.14 or later is required. To upgrade, see Manually upgrade an ACK cluster.
Cluster environment: CSI is fully tested and validated in ACK clusters. For non-ACK clusters (non-Alibaba Cloud environments, self-managed clusters on Alibaba Cloud), CSI may not work out of the box due to differences in configuration, permissions, and networking.
For non-ACK environments, see the alibaba-cloud-csi-driver source code and adapt it to your environment.
Node configuration: The
kubeletparameter--enable-controller-attach-detachmust be set totrue.Operating system: Windows nodes are not supported.
RBAC permissions: PVs are cluster-scoped resources, and PVCs are namespace-scoped resources. When you configure RBAC, consider the permission differences for these two resource types.
If the predefined ACK roles (administrator, O&M engineer, and others) do not meet your needs, create custom roles. For example, the default O&M engineer role has read-write access to PVCs but read-only access to PVs, so it cannot create PVs manually. For more information, see Grant RBAC permissions to a RAM user or RAM role.
FAQ
How to determine which storage plugin your cluster uses?
Use one of the following methods.
Check node annotations in the 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 Actions column, click Details, and then check the node Annotations on the Overview tab.
If the annotation
volumes.kubernetes.io/controller-managed-attach-detach: trueexists, the cluster uses CSI. Otherwise, it uses Flexvolume.
Check kubelet parameters via the command line
Log on to a node and check the kubelet parameters.
ps -ef | grep kubeletExample output (truncated):
--enable-controller-attach-detach=truetrue: CSIfalse: Flexvolume
How do I grant CSI permissions manually?
CSI requires permissions to access other Alibaba Cloud services when it attaches, detaches, creates, or deletes volumes. By default, CSI is installed with the required permissions. If you need to grant permissions manually, use one of the following methods.
RAM role authorization (default): CSI uses the AliyunCSManagedCsiRole role to access other cloud services. For more information, see ACK roles.
ACK managed clusters: The RAM role token is stored in a Secret named
addon.csi.token. Mount this Secret to authorize CSI through the RAM role.ACK dedicated clusters: CSI inherits the RAM role of the node where its Pod runs.
For more information about granting permissions to RAM roles, see Manage permissions for a RAM role.
AccessKey authorization:
Environment variables: Create the AccessKey as a Kubernetes Secret, then inject it into the CSI Pod as environment variables. This prevents credentials from being exposed in plaintext in deployment manifests.
Inline YAML: Write the AccessKey directly in the CSI YAML. Not recommended for production environments.