Each Alibaba Cloud Container Service (ACS) pod includes 30 GiB of free ephemeral storage by default. If your workload needs more space — for example, to accommodate large container images or high-volume log output — declare additional storage when creating the pod.
The container image is stored in the pod's ephemeral storage. The space consumed by the image is at least two times the image size; the actual amount depends on the image's compression ratio. Account for this when sizing your ephemeral storage.
Billing
Storage beyond the default 30 GiB free tier is billed based on disk pricing:
Fee = Unit price of disks × Ephemeral storage overage × Duration
| Variable | Description |
|---|---|
| Unit price of disks | Pay-as-you-go price of PL1 ESSDs. For prices by region, see EBS pricing. |
| Ephemeral storage overage | The additional storage you declared above 30 GiB. |
| Duration | Measured in seconds. Ephemeral storage is created and released together with the pod. |
Prerequisites
Before you begin, make sure that you have:
-
An ACS cluster with kubectl configured to connect to it
-
Permission to create Deployments in the target namespace
Configure ephemeral storage
Two methods are available. Use the annotation method (Method 1) unless you specifically need to control ephemeral storage through container resource specs.
Method 1 (recommended): Add an annotation
Add the alibabacloud.com/extra-ephemeral-storage annotation to the pod template. The value specifies additional storage on top of the default 30 GiB.
Method 2: Configure the container resource
Set the total ephemeral storage size in .resources.requests.ephemeral-storage on the container.
If the declared value is less than 30 GiB, ACS automatically expands the ephemeral storage to 30 GiB. Only storage declared above 30 GiB counts as overage for billing purposes.
Example: add 20 GiB of ephemeral storage
The following example declares an additional 20 GiB of ephemeral storage, bringing the total to 50 GiB (30 GiB default + 20 GiB additional).
Step 1: Create the YAML file
Create a file named extra-storage.yaml using one of the following methods.
Method 1: Add an annotation
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
annotations:
alibabacloud.com/extra-ephemeral-storage: "20Gi" # Additional storage on top of the default 30 GiB.
spec:
containers:
- name: nginx
image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginx:latest
ports:
- containerPort: 80
Method 2: Configure the container resource
apiVersion: apps/v1
kind: Deployment
metadata:
name: test
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: registry.cn-hangzhou.aliyuncs.com/acs-sample/nginx:latest
ports:
- containerPort: 80
resources:
requests:
ephemeral-storage: 50Gi # Total ephemeral storage size (30 GiB default + 20 GiB additional).
Step 2: Create the workload
kubectl apply -f extra-storage.yaml
Step 3: Verify the pod is running
kubectl get pod
Expected output:
NAME READY STATUS RESTARTS AGE
test-ff8767b7b-**** 1/1 Running 0 54s
Step 4: Confirm the ephemeral storage size
a. Check the pod annotation.
The alibabacloud.com/pod-ephemeral-storage annotation shows the total ephemeral storage in GiB.
kubectl describe pod test-ff8767b7b-**** | grep alibabacloud.com/pod-ephemeral-storage
Expected output:
alibabacloud.com/pod-ephemeral-storage: 50Gi
b. Check the container file system.
Log in to the container and run df -h to confirm the file system reflects the new size.
kubectl exec -it test-ff8767b7b-**** -- sh
df -h
Expected output — the overlay row shows the 50 GiB root file system available to the container:
Filesystem Size Used Avail Use% Mounted on
overlay 50G 2.7G 45G 6% /
tmpfs 64M 0 64M 0% /dev
tmpfs 2.8G 0 2.8G 0% /sys/fs/cgroup
/dev/vda5 50G 2.7G 45G 6% /etc/hosts
shm 64M 0 64M 0% /dev/shm
tmpfs 4.0G 12K 4.0G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 2.8G 0 2.8G 0% /proc/acpi
tmpfs 2.8G 0 2.8G 0% /proc/scsi
tmpfs 2.8G 0 2.8G 0% /sys/firmware