Updated on 2025-11-21 GMT+08:00

Mounting an Ephemeral Volume

In CCI 2.0, you can mount an emptyDir volume for ephemeral storage.

Constraints

  • Subpaths are not supported.
  • The sizeLimit parameter of emptyDir is only valid when emptyDir.medium is set to Memory.
  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Workloads. Then click Create Workload.
  3. In the Data Storage area, click Add Volume. Then set Storage Type to emptyDir volume and enter a volume name.

    There are three options for data storage: emptyDir volume, ConfigMap, and secret. Here, set Storage Type to emptyDir volume.

  4. Add a container: Configure basic information for the container and click Next.
  5. Configure advanced settings for the container: Mount the emptyDir volume added in 3 to the container.

  6. Select the image repository access credential, configure the upgrade policy, and complete the workload creation.

  7. Click the workload name to view the pod.

  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Workloads. Then, click Create from YAML and replace the YAML content to create the workload.

    The following shows an example YAML for creating a workload:

    kind: Deployment
    apiVersion: cci/v2
    metadata:
      name: demoapp    # Workload name
      namespace: test  # Namespace where the workload is located
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: demoapp
      template:
        metadata:
          creationTimestamp: null
          labels:
            app: demoapp
          annotations:
            resource.cci.io/instance-type: general-computing    # Pod type: general-computing pods
            resource.cci.io/pod-size-specs: 1.00_2.0
        spec:
          volumes:              # An ephemeral volume is used.
            - name: app-log
              emptyDir: {}
          containers:
            - name: demoapp
              image: nginx:stable-alpine-perl # Image path. Replace it with your own image path.
              resources:
                limits:
                  cpu: '1'
                  memory: 2G
                requests:
                  cpu: '1'
                  memory: 2G
              volumeMounts:        # Mount an ephemeral volume to the container.
                - name: app-log
                  readOnly: true
                  mountPath: /usr/local/logs
              terminationMessagePath: /dev/termination-log
              terminationMessagePolicy: File
          restartPolicy: Always
          terminationGracePeriodSeconds: 30
          dnsPolicy: Default
          securityContext: {}
          imagePullSecrets:
            - name: imagepull-secret
          schedulerName: default-scheduler
      strategy:
        type: RollingUpdate
        rollingUpdate:
          maxUnavailable: 25%
          maxSurge: 100%
      progressDeadlineSeconds: 600