1. First create PVC in the namespace (‘Data Science Project’) where you want to use ‘Data Connection’ type URI.
kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: granite-8b-code-base-pvc
spec:
accessModes:
- ReadWriteMany
volumeMode: Filesystem
resources:
requests:
storage: <model size>
storageClassName: <storage class>
2. Next, create the downloader pod and update the environment variables to configure the object storage connection. This pod will download the model artifacts into the attached PVC.
apiVersion: v1
kind: Pod
metadata:
name: granite-8b-instruct
labels:
name: granite-8b-instruct
spec:
volumes:
- name: model-volume
persistentVolumeClaim:
claimName: granite-8b-code-claim
restartPolicy: Never
initContainers:
- name: fix-volume-permissions
image: quay.io/quay/busybox@sha256:92f3298bf80a1ba949140d77987f5de081f010337880cd771f7e7fc928f8c74d
command: ["sh"]
args: ["-c", "mkdir -p /mnt/models/$(MODEL_PATH) && chmod -R 777 /mnt/models"]
volumeMounts:
- mountPath: "/mnt/models/"
name: model-volume
env:
- name: MODEL_PATH
value: <model path>
containers:
- resources:
requests:
memory: 40Gi
name: download-model
imagePullPolicy: IfNotPresent
image: quay.io/opendatahub/kserve-storage-initializer:v0.14
args:
- 's3://$(BUCKET_NAME)/$(MODEL_PATH)/'
- /mnt/models/$(MODEL_PATH)
env:
- name: AWS_ACCESS_KEY_ID
value: <Add real value Here>
- name: AWS_SECRET_ACCESS_KEY
value: <Add real value Here>
- name: BUCKET_NAME
value: prasad
- name: MODEL_PATH
value: /ibm-granite/granite-3.0-8b-instruct/
- name: S3_USE_HTTPS
value: "1"
- name: AWS_ENDPOINT_URL
value: https://hel1.your-objectstorage.com
- name: awsAnonymousCredential
value: 'false'
- name: AWS_DEFAULT_REGION
value: none
- name: S3_VERIFY_SSL
value: 'true'
volumeMounts:
- mountPath: "/mnt/models/"
name: model-volume
Now in OpenShift AI, create new storage connection with below configuration.
storageUri: pvc://<pvc name>/<model path>
Use this storage connection to skip storage initialisation time.
Note : the storageUri should be this: pvc://<model name>. No need to put /mnt/model in the path.