Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Kserve Kserve PVC Storage Initializer

From Leeroopedia
Knowledge Sources
Domains Storage, MLOps, LLM_Serving
Last Updated 2026-02-13 00:00 GMT

Overview

Concrete YAML pattern for creating a PVC and download Job to pre-stage large LLM weights before serving.

Description

The pattern uses the KServe storage initializer container image (quay.io/opendatahub/kserve-storage-initializer) in a Kubernetes Job to download model weights from HuggingFace Hub to a PersistentVolumeClaim. The PVC uses ReadWriteMany access mode for multi-pod sharing.

Usage

Create the PVC and Job before deploying the LLMInferenceService. The model URI in the LLMIsvc spec should reference the PVC as pvc://<pvc-name>.

Code Reference

Source Location

  • Repository: kserve
  • File: docs/samples/storage/pvc-init/pvc.yaml, Lines 1-14
  • File: docs/samples/storage/pvc-init/job.yaml, Lines 1-43

Signature

PVC

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: llm-test-pvc-deepseek
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 1Ti
  storageClassName: ibm-spectrum-scale-fileset

Download Job

apiVersion: batch/v1
kind: Job
metadata:
  name: download-model
spec:
  template:
    spec:
      containers:
        - name: download
          image: quay.io/opendatahub/kserve-storage-initializer:v0.15-latest
          args:
            - "hf://deepseek-ai/DeepSeek-R1-0528"
            - "/mnt/models"
          env:
            - name: HF_XET_NUM_CONCURRENT_RANGE_GETS
              value: "8"
            - name: HF_XET_HIGH_PERFORMANCE
              value: "True"
          resources:
            limits:
              memory: 100Gi
          volumeMounts:
            - name: model-volume
              mountPath: /mnt/models
      volumes:
        - name: model-volume
          persistentVolumeClaim:
            claimName: llm-test-pvc-deepseek
      serviceAccountName: hfsa
      restartPolicy: Never

Import

kubectl apply -f pvc.yaml
kubectl apply -f job.yaml

I/O Contract

Inputs

Name Type Required Description
PVC storage StorageClass Yes Must support ReadWriteMany
HF_TOKEN Secret Yes HuggingFace authentication (via ServiceAccount)
Model URI string Yes hf://org/model format

Outputs

Name Type Description
PVC with model PersistentVolumeClaim Model weights at /mnt/models on the PVC
pvc:// URI string Reference as pvc://llm-test-pvc-deepseek in LLMIsvc

Usage Examples

Download and Reference

# 1. Create PVC
kubectl apply -f pvc.yaml

# 2. Start download
kubectl apply -f job.yaml

# 3. Monitor download progress
kubectl logs job/download-model -f

# 4. Reference in LLMInferenceService
# spec.model.uri: "pvc://llm-test-pvc-deepseek"

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment