Use local disk volumes for GPU-HPN capacity reservation

更新时间:
复制 MD 格式

Remote storage latency can slow high-frequency I/O such as training data shuffling and inference caching. Pass local NVMe disks on GPU-HPN nodes directly to GPU Pods as block devices, bypassing the file system layer for near-bare-metal performance.

How it works

GPU-HPN capacity reservation nodes include local NVMe disks. The acs-local-passthrough-controller component exposes these disks to GPU Pods as block devices, bypassing the file system layer for near-bare-metal I/O performance.

Dimension

Implementation

Mount type

Block device (volumeMode: Block).

Scheduling awareness

Based on CSI StorageCapacity, the scheduler automatically places the Pod on a node with an available local disk.

Exclusivity

Once a PVC is bound, it is permanently associated with a physical disk and exclusive to the Pod that references it. You can create multiple PVCs concurrently, each claiming one disk.

Capacity

The system allocates the entire physical disk, regardless of the value specified in the storage request. The disk is not partitioned.

Lifecycle

The controller automatically handles disk discovery, allocation, data erasure, and reclamation. When you delete the PVC, the reclaimPolicy: Delete policy of the local-passthrough StorageClass triggers data erasure.

Local disks provide ephemeral storage, and the data is not persistent. Do not store data that cannot be easily recreated, such as model checkpoints or training logs. For data that requires persistence, use NAS, OSS, or CPFS volumes.

The following table shows how local disk data is affected in different scenarios.

Event category

Event

Local disk data

Pod operation

The Pod is deleted and recreated, but the PVC is retained.

Retained

Resource reclamation

Delete the PVC.

Deleted

Node

Node failure, release, or local disk damage

Lost

Prerequisites

  • You have an ACS of version 1.33 or later.

  • You have created a GPU-HPN capacity reservation and associated it with your cluster. The reservation provides dedicated physical nodes with local NVMe disks. The scheduler only assigns Pods with the compute-class: gpu-hpn label to these nodes. For more information, see GPU-HPN capacity reservation.

  • The following components and versions are available only through an allowlist. You must first Submit a ticket to request access:

    • virtual-kubelet v2.18.0-rc.2 or later

    • acs-local-passthrough-controller

Mount and use a local disk volume

Step 1: Check for available NVMe disks

Before creating a PVC, ensure your cluster has available local NVMe disks.

  1. Run the following command to check for available local NVMe disks on each node:

    kubectl get csistoragecapacities -n kube-system \
      -l csi.storage.k8s.io/drivername=local-passthrough.csi.alibabacloud.com \
      -o jsonpath='{range .items[?(@.capacity!="0")]}{.metadata.name}{"\t"}{.nodeTopology.matchLabels.csi\.alibabacloud\.com/node-name}{"\t"}{.maximumVolumeSize}{"\t"}{.capacity}{"\n"}{end}' \
      | awk 'BEGIN{printf "%-14s %-50s %-16s %s\n","NAME","NODE","DISK-SIZE","AVAILABLE"} {split($3,a,"Ki");split($4,b,"Ki");printf "%-14s %-50s %-16s %d\n",$1,$2,$3,b[1]/a[1]}'
  2. Check the expected output:

    NAME           NODE                                               DISK-SIZE        AVAILABLE
    csisc-12345    cn-wulanchabu-c.cr-ovt2bz1uoiyoxxxxxxxxx           3750738264Ki     2
    csisc-abcde    cn-wulanchabu-b.cr-xyz123456789xxxxxxxxx           3750738264Ki     1
    • DISK-SIZE: The capacity of a single disk (maximumVolumeSize).

    • AVAILABLE: The number of remaining allocatable disks on the node (capacity / maximumVolumeSize).

    Note

    If AVAILABLE is 0 for all nodes, all disks are in use. You must wait for other PVCs to be released or scale out the nodes.

Step 2: Create a PVC

  1. Create a file named pvc.yaml that uses the local-passthrough StorageClass. Installing the acs-local-passthrough-controller component creates the local-passthrough StorageClass by default. Its reclaim policy is reclaimPolicy: Delete and its binding mode is WaitForFirstConsumer.

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: local-disk-pvc
      namespace: default
    spec:
      accessModes:
        - ReadWriteOncePod    # Exclusive access by a single Pod.
      volumeMode: Block       # Only the block device mode is supported.
      storageClassName: local-passthrough
      resources:
        requests:
          storage: 10Gi       # Must be less than or equal to the DISK-SIZE from Step 1. The entire physical disk is allocated.
  2. Apply the configuration:

    kubectl apply -f pvc.yaml

    Because the StorageClass uses the WaitForFirstConsumer binding mode, the PVC remains in the Pending state until a Pod references it.

    Note

    If the requested storage value exceeds the DISK-SIZE from Step 1, the PVC creation fails.

Step 3: Create a GPU Pod and mount the disk

  1. Create pod.yaml and use volumeDevices to attach a block device:

    apiVersion: v1
    kind: Pod
    metadata:
      name: gpu-workload
      namespace: default
      labels:
        alibabacloud.com/compute-class: "gpu-hpn"   # Required. Specifies the GPU-HPN compute type.
    spec:
      containers:
        - name: main
          # Example: alibaba-cloud-linux-3-registry.cn-hangzhou.cr.aliyuncs.com/alinux3/alinux3:latest
          image: <your-gpu-image>
          volumeDevices:                            # Use volumeDevices for block devices.
            - name: local-disk
              devicePath: /dev/xvda
      volumes:
        - name: local-disk
          persistentVolumeClaim:
            claimName: local-disk-pvc
  2. Apply the configuration:

    kubectl apply -f pod.yaml

Step 4: Verify the mount and data persistence

  1. Confirm that the PVC is bound:

    kubectl get pvc local-disk-pvc

    Expected output:

    NAME             STATUS   VOLUME                                                  CAPACITY       ACCESS MODES   STORAGECLASS        AGE
    local-disk-pvc   Bound    local-passthrough-d0cfcee6-734d-4d59-ae76-xxxxxxxxxxxx  3750738264Ki   RWOP           local-passthrough   1m

    A STATUS of Bound confirms that the PVC is bound to a local NVMe disk and ready for use.

  2. Confirm that the block device is visible inside the Pod:

    kubectl exec gpu-workload -- lsblk
  3. Write data to the block device and then read it back:

    # Write data to the block device.
    kubectl exec gpu-workload -- sh -c 'echo "test" > /dev/xvda'
    
    # Read the data to verify.
    kubectl exec gpu-workload -- head -c 5 /dev/xvda

    Expected output: test

  4. Verify that data persists after Pod recreation (delete only the Pod, not the PVC):

    # Delete the Pod but keep the PVC.
    kubectl delete pod gpu-workload
    
    # Recreate the Pod by using the same configuration.
    kubectl apply -f pod.yaml
    
    # Wait for the Pod to be ready, then read the data.
    kubectl wait --for=condition=ready pod/gpu-workload --timeout=60s
    kubectl exec gpu-workload -- head -c 5 /dev/xvda

    The expected output is still: test

Note

As long as you do not delete the PVC, recreating the Pod schedules it back to the original node and reattaches it to the same disk, so the data persists. Deleting the PVC immediately erases the data.

Clean up resources

Deleting a PVC triggers the reclaimPolicy: Delete policy of the local-passthrough StorageClass, which erases disk data before returning the disk to the capacity pool.

# Clean up the Pod and PVC.
kubectl delete pod gpu-workload
kubectl delete pvc local-disk-pvc

Verify reclamation: After you recreate the PVC and Pod, the newly allocated disk should be empty:

# Recreate the PVC and Pod.
kubectl apply -f pvc.yaml
kubectl apply -f pod.yaml

# Wait for the Pod to be ready.
kubectl wait --for=condition=ready pod/gpu-workload --timeout=60s

# Read from the block device.
kubectl exec gpu-workload -- head -c 5 /dev/xvda

Expected result: No output (or null bytes), confirming that the allocated disk is empty.

Important
  • The reclaimPolicy: Delete action is irreversible. Before you delete a PVC, ensure that all necessary data is backed up to persistent storage.

  • Recreating a PVC does not guarantee that the scheduler will place the new Pod on the original node. To verify data erasure on a specific node, you can add node affinity to your Pod, create enough Pods to occupy all disks on that node, and then verify each one.

Next steps

  • Configure your training or inference workload to read from and write to /dev/xvda. If needed, you can run mkfs.ext4 /dev/xvda inside the container to format it and mount it as a file system, or you can use it directly for block I/O. The mkfs command is a privileged operation and requires allowlist access. To request access, Submit a ticket.

  • Evaluate your caching strategy. Store only reproducible intermediate data on the local disk. Keep model weights and checkpoints on persistent storage, such as CPFS.

  • Monitor disk usage. Periodically check the node-level capacity by running kubectl get csistoragecapacities.

Quotas and limitations

  • Only the block device mode (volumeMode: Block) is supported. To use a file system, you must run mkfs inside the container to format the device. The mkfs command is a privileged operation and requires allowlist access. To request access, Submit a ticket.

  • This feature supports only the ReadWriteOncePod access mode. Only one Pod can mount a single disk exclusively at a time. Multi-Pod sharing is not available.

  • Local disks are tightly coupled to their nodes and do not support cross-node access.

  • The physical disk size is fixed; you cannot scale it elastically.

  • Each GPU-HPN Pod can mount only one local NVMe disk.

FAQ

Why are my Pod and PVC stuck in the Pending state?

In WaitForFirstConsumer mode, PVC binding depends on successful Pod scheduling. First investigate why the Pod is failing to schedule.

kubectl describe pod gpu-workload

Common causes:

Symptom

Cause

Troubleshooting/solution

FailedScheduling and no node found

No node satisfies both the GPU resource and available local NVMe disk requirements.

Follow the instructions in Step 1 to confirm that a node with AVAILABLE > 0 exists.

FailedScheduling and scheduler skips a node

The Pod is missing the alibabacloud.com/compute-class: "gpu-hpn" label.

Add the label to the Pod specification.

FailedScheduling and nodeSelector mismatch

A custom nodeSelector or affinity conflicts with the nodes that have available disks.

Adjust the scheduling constraints.

AttachVolume or MountVolume error

An issue exists with the PVC.

Run kubectl describe pvc <pvc-name> to view events.

Why do I get an "insufficient space" error when writing large files?

The actual writable capacity is the full physical capacity of the disk (DISK-SIZE), regardless of the storage request value in the PVC.

How can I make my data persistent?

Local disks do not provide a persistence guarantee. For data that requires persistence, use NAS, OSS, or CPFS volumes.