Alaya NeW Cloud

Create a PersistentVolumeClaim

How to create static and dynamic PVCs in VKS and mount them in containers

When provisioning a VKS cluster, system storage capacity is provisioned at the same time according to the customer request.

VKS supports two ways to provision system Persistent Volumes by default: static and dynamic.

VKS hides the underlying storage details — you simply declare a PVC and mount it into your container directory. For more on Kubernetes storage, see the official storage docs.

Tip

  • All accounts with permission share the static storage. Static storage can share data across resource manifests.
  • Dynamic storage is capped at 10 GB and cannot be expanded — static storage is recommended.

Static PVC declaration

When you create a namespace, static-storage PVCs are created automatically — no need to declare them explicitly:

  1. pvc-capacity-userdata: read-write (directories and files in this cluster).
  2. pvc-capacity-share: read-only (all directories and files under the company).
  3. pvc-capacity-app: read-only (directories and files under provisioned apps such as Inference, LM Lab).

Inspect:

kubectl get pvc -n test

Get static PVC

If you have other storage provisioned, request PV creation via the Alaya NeW website's online inquiry, then declare it as:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: your-pvc-name
spec:
  volumeName: your-pv-name
  accessModes:
    - ReadWriteMany

Tip: Replace your-pvc-name and your-pv-name with the names of your provisioned PV.

Dynamic PVC declaration

Get available StorageClass:

kubectl get storageClass

Get StorageClass

Example:

# VKS dynamic PVC declaration
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: your-pvc-name
  namespace: your-namespace
spec:
  storageClassName: your-storage-class  # the storageClass from the previous step
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Gi

Use the storage

Mount your declared PVC into a directory inside the container. For static storage, set claimName to pvc-capacity-userdata (read-write, used inside VKS). For dynamic storage (up to 10 GB), use the PVC name you declared.

Example:

# pod uses storage
template:
  metadata:
    labels:
      app: your-label
  spec:
    containers:
      - name: your-container-name
        image: your-image    # replace with your own image
        command: your-command
        ports:
          - containerPort: your-port-num
        volumeMounts:
          - name: data-volume
            mountPath: /mnt/test  # mount path inside the container
    volumes:
      - name: data-volume
        persistentVolumeClaim:
          claimName: pvc-capacity-userdata  # for dynamic storage, put your declared PVC name here

Last updated on

Was this page helpful?

On this page