Each pod in a workload is provided with 30-GiB free storage capacity by default (maximum IOPS of 2,500 and maximum burst IOPS of 16,000). The OS and CCE platform components will occupy some storage space, and the total available capacity for images, containers, and ephemeral storage is about 20 GiB. If the storage capacity cannot meet service requirements, you can add ephemeral storage for a pod on the console or by running kubectl commands. The ephemeral storage is billed by capacity and usage duration. For details, see Pricing Details.
Constraints
The cluster version must be v1.27.8-r0, v1.28.6-r0, or later. If the cluster version does not meet the requirements, you need to upgrade the cluster.
Adding Ephemeral Storage for a Pod
Increase the ephemeral storage capacity for a pod using the console or kubectl.
The following are operations for you to add ephemeral storage capacity for a pod on the console. For details about workload parameters, see Creating a Workload.
Log in to the CCE console and click the cluster name to access the cluster console.
In the navigation pane on the left, choose Workloads.
To add ephemeral storage for a pod during workload creation, select the workload type and click Create Workload in the upper right corner of the page.
To add ephemeral storage for a pod of an existing workload, locate the workload and click Upgrade in the Operation column.
Add ephemeral storage for a pod in either of the following methods.
Table 1 Two methods of adding ephemeral storage for a pod
In the Advanced Settings area, choose Labels and Annotations.
Enter resource.cce.io/extra-ephemeral-storage-in-GiB as the key of the pod annotation.
In the Value text box of the pod annotation, enter the storage capacity (a value from 0 to 994) to be added and click Confirm.
NOTE:
After this annotation is added to the pod, the ephemeral storage per pod in the area for confirming the specifications changes from 30 GiB to 40 GiB (the default pod storage plus the added ephemeral storage).
Figure 1 Adding ephemeral storage for a pod
Figure 2 Single-Pod Ephemeral Storage
Modifying the ephemeral storage for a pod
40 GiB
In the area for confirming the specifications, click next to Single-Pod Ephemeral Storage.
In the displayed dialog box, enter the required capacity. The required capacity is the sum of the default 30-GiB capacity and the ephemeral storage to be added. The value ranges from 30 to 1024.
NOTICE:
If you are not sure how much ephemeral storage needs to be added for a pod, retain the recommended value, which is the value of Single-Pod Ephemeral Storage. After an image is selected, the recommended value will be calculated based on the size of the selected image and the storage capacity required by the OS. The recommended ephemeral storage for a pod is either the 30-GiB free storage or the sum of system storage and 2-fold image size, whichever is greater. (Formula: Recommended ephemeral storage for a pod = Max. (30-GiB free storage, Sum of system storage and image size x 2))
Figure 3 Modifying the ephemeral storage for a pod
Click OK.
Select I have read and agree to the pricing policy and click Create Workload or Upgrade Workload.
You can run kubectl commands to add ephemeral storage capacity for a pod. You can add ephemeral storage capacity when creating a workload or modify the ephemeral storage for a pod of an existing workload. For details about workload parameters, see Creating a Workload.
NOTE:
Command line operations are required. You can perform related operations in either of the following ways:
Use the command line tool in the cluster. The kubectl commands have been configured for the command line tool, which has been connected to the cluster.
Log in to an ECS that is in the same VPC as the cluster, and access the cluster using kubectl by following the instructions in Connecting to a Cluster Using kubectl.
Create a workload and add ephemeral storage for a pod.
Create a YAML file for creating a workload. The file name can be customized. In this example, the file name is extra-ephemeral-storage-test.yaml.
vim extra-ephemeral-storage-test.yaml
Example file content:
apiVersion: apps/v1
kind: Deployment
metadata:
name: extra-ephemeral-storage-test # Workload name
spec:
replicas: 1 # Number of pods
selector:
matchLabels: # Selector for selecting resources with specific labels
app: nginx
template:
metadata:
labels: # Labels
app: nginx
annotations: resource.cce.io/extra-ephemeral-storage-in-GiB: '10'
spec:
containers:
- image: nginx:latest # {Image name}:{Image tag}
name: nginx
imagePullSecrets:
- name: default-secret
resource.cce.io/extra-ephemeral-storage-in-GiB indicates the ephemeral storage capacity added to the pod. The value ranges from 0 to 994. In this example, the value is 10. The total ephemeral storage capacity of a pod is the sum of the 30-GiB default capacity and the value of this parameter.
Press Esc to exit editing mode and enter :wq to save the file.
If READY is 1/1 in the command output, the workload has been created. The ephemeral storage capacity of the pod in the workload has changed to the value you set.
NAME READY UP-TO-DATE AVAILABLE AGE
nova-test 1/1 1 1 59s
View the ephemeral storage capacity of the pod.
Run the following command to query the pod name (extra-ephemeral-storage-test indicates the workload name):
kubectl get pod | grep extra-ephemeral-storage-test
Information similar to the following is displayed:
If the total storage capacity of the pod is 40 GiB in the command output, the ephemeral storage is added for the pod. Enter exit and press Enter to exit the pod.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 40G 0 disk
├─vda1 254:1 0 59M 0 part
├─vda2 254:2 0 1.5G 0 part
├─vda3 254:3 0 1.5G 0 part
└─vda4 254:4 0 37G 0 part /etc/resolv.conf
Add ephemeral storage capacity for a pod of an existing workload.
Modify the YAML file of the target workload and add the resource.cce.io/extra-ephemeral-storage-in-GiB annotation. The following uses a Deployment named extra-ephemeral-storage-test as an example.
Add the resource.cce.io/extra-ephemeral-storage-in-GiB annotation in the lower part of the file. Press Esc to exit editing mode and enter :wq to save the file.
resource.cce.io/extra-ephemeral-storage-in-GiB indicates the ephemeral storage capacity added to the pod. The value ranges from 0 to 994. In this example, the value is 10. The total ephemeral storage capacity of a pod is the sum of the 30-GiB default capacity and the value of this parameter.
View the workload status.
kubectl get deployment
If READY is 1/1, the workload has been upgraded. The ephemeral storage capacity of the pod in the workload has changed to the value you set.
NAME READY UP-TO-DATE AVAILABLE AGE
nova-test 1/1 1 1 59m
View the ephemeral storage capacity of the pod.
Run the following command to query the pod name (extra-ephemeral-storage-test indicates the workload name):
kubectl get pod | grep extra-ephemeral-storage-test
Information similar to the following is displayed:
If the total storage capacity of the pod is 40 GiB in the command output, the ephemeral storage is added for the pod. Enter exit and press Enter to exit the pod.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 40G 0 disk
├─vda1 254:1 0 59M 0 part
├─vda2 254:2 0 1.5G 0 part
├─vda3 254:3 0 1.5G 0 part
└─vda4 254:4 0 37G 0 part /etc/resolv.conf
The following are operations for you to add ephemeral storage capacity for a pod on the console. For details about workload parameters, see Creating a Workload.
Log in to the CCE console and click the cluster name to access the cluster console.
In the navigation pane on the left, choose Workloads.
To add ephemeral storage for a pod during workload creation, select the workload type and click Create Workload in the upper right corner of the page.
To add ephemeral storage for a pod of an existing workload, locate the workload and click Upgrade in the Operation column.
Add ephemeral storage for a pod in either of the following methods.
Table 1 Two methods of adding ephemeral storage for a pod
In the Advanced Settings area, choose Labels and Annotations.
Enter resource.cce.io/extra-ephemeral-storage-in-GiB as the key of the pod annotation.
In the Value text box of the pod annotation, enter the storage capacity (a value from 0 to 994) to be added and click Confirm.
NOTE:
After this annotation is added to the pod, the ephemeral storage per pod in the area for confirming the specifications changes from 30 GiB to 40 GiB (the default pod storage plus the added ephemeral storage).
Figure 1 Adding ephemeral storage for a pod
Figure 2 Single-Pod Ephemeral Storage
Modifying the ephemeral storage for a pod
40 GiB
In the area for confirming the specifications, click next to Single-Pod Ephemeral Storage.
In the displayed dialog box, enter the required capacity. The required capacity is the sum of the default 30-GiB capacity and the ephemeral storage to be added. The value ranges from 30 to 1024.
NOTICE:
If you are not sure how much ephemeral storage needs to be added for a pod, retain the recommended value, which is the value of Single-Pod Ephemeral Storage. After an image is selected, the recommended value will be calculated based on the size of the selected image and the storage capacity required by the OS. The recommended ephemeral storage for a pod is either the 30-GiB free storage or the sum of system storage and 2-fold image size, whichever is greater. (Formula: Recommended ephemeral storage for a pod = Max. (30-GiB free storage, Sum of system storage and image size x 2))
Figure 3 Modifying the ephemeral storage for a pod
Click OK.
Select I have read and agree to the pricing policy and click Create Workload or Upgrade Workload.
You can run kubectl commands to add ephemeral storage capacity for a pod. You can add ephemeral storage capacity when creating a workload or modify the ephemeral storage for a pod of an existing workload. For details about workload parameters, see Creating a Workload.
NOTE:
Command line operations are required. You can perform related operations in either of the following ways:
Use the command line tool in the cluster. The kubectl commands have been configured for the command line tool, which has been connected to the cluster.
Log in to an ECS that is in the same VPC as the cluster, and access the cluster using kubectl by following the instructions in Connecting to a Cluster Using kubectl.
Create a workload and add ephemeral storage for a pod.
Create a YAML file for creating a workload. The file name can be customized. In this example, the file name is extra-ephemeral-storage-test.yaml.
vim extra-ephemeral-storage-test.yaml
Example file content:
apiVersion: apps/v1
kind: Deployment
metadata:
name: extra-ephemeral-storage-test # Workload name
spec:
replicas: 1 # Number of pods
selector:
matchLabels: # Selector for selecting resources with specific labels
app: nginx
template:
metadata:
labels: # Labels
app: nginx
annotations: resource.cce.io/extra-ephemeral-storage-in-GiB: '10'
spec:
containers:
- image: nginx:latest # {Image name}:{Image tag}
name: nginx
imagePullSecrets:
- name: default-secret
resource.cce.io/extra-ephemeral-storage-in-GiB indicates the ephemeral storage capacity added to the pod. The value ranges from 0 to 994. In this example, the value is 10. The total ephemeral storage capacity of a pod is the sum of the 30-GiB default capacity and the value of this parameter.
Press Esc to exit editing mode and enter :wq to save the file.
If READY is 1/1 in the command output, the workload has been created. The ephemeral storage capacity of the pod in the workload has changed to the value you set.
NAME READY UP-TO-DATE AVAILABLE AGE
nova-test 1/1 1 1 59s
View the ephemeral storage capacity of the pod.
Run the following command to query the pod name (extra-ephemeral-storage-test indicates the workload name):
kubectl get pod | grep extra-ephemeral-storage-test
Information similar to the following is displayed:
If the total storage capacity of the pod is 40 GiB in the command output, the ephemeral storage is added for the pod. Enter exit and press Enter to exit the pod.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 40G 0 disk
├─vda1 254:1 0 59M 0 part
├─vda2 254:2 0 1.5G 0 part
├─vda3 254:3 0 1.5G 0 part
└─vda4 254:4 0 37G 0 part /etc/resolv.conf
Add ephemeral storage capacity for a pod of an existing workload.
Modify the YAML file of the target workload and add the resource.cce.io/extra-ephemeral-storage-in-GiB annotation. The following uses a Deployment named extra-ephemeral-storage-test as an example.
Add the resource.cce.io/extra-ephemeral-storage-in-GiB annotation in the lower part of the file. Press Esc to exit editing mode and enter :wq to save the file.
resource.cce.io/extra-ephemeral-storage-in-GiB indicates the ephemeral storage capacity added to the pod. The value ranges from 0 to 994. In this example, the value is 10. The total ephemeral storage capacity of a pod is the sum of the 30-GiB default capacity and the value of this parameter.
View the workload status.
kubectl get deployment
If READY is 1/1, the workload has been upgraded. The ephemeral storage capacity of the pod in the workload has changed to the value you set.
NAME READY UP-TO-DATE AVAILABLE AGE
nova-test 1/1 1 1 59m
View the ephemeral storage capacity of the pod.
Run the following command to query the pod name (extra-ephemeral-storage-test indicates the workload name):
kubectl get pod | grep extra-ephemeral-storage-test
Information similar to the following is displayed:
If the total storage capacity of the pod is 40 GiB in the command output, the ephemeral storage is added for the pod. Enter exit and press Enter to exit the pod.
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 40G 0 disk
├─vda1 254:1 0 59M 0 part
├─vda2 254:2 0 1.5G 0 part
├─vda3 254:3 0 1.5G 0 part
└─vda4 254:4 0 37G 0 part /etc/resolv.conf