Usage example
Create a PersistentVolumeClaim that uses a configured StorageClass to
dynamically provision a volume. The example below uses “storpool-csi”
for StorageClass.
[k8s-master]# cat > pvclaim.yaml << _EOF_
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-storpool-csi-request
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: storpool-csi
_EOF_
[k8s-master]# kubectl apply -f pvclaim.yaml
[k8s-master]# kubectl get pvc
The persistent claim should be listed, and its status should change to
Pending, if everything is working. The newly created volume should be listed
in the pv’s:
[k8s-master]# kubectl get pv
Hint
In case this is not happening,
kubectl describe pvc my-storpool-csi-request, might list a StorPool
generated event e.g. noResources, or template missing, more info will be
available in the storpool_mgmt API logs (/var/log/debug and
/var/log/storpool/mgmt.log).
Create a pod:
[k8s-master]# cat > pod.yaml << _EOF_
kind: Pod
apiVersion: v1
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: my-storpool-csi-request
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
_EOF_
[k8s-master]# kubectl apply -f pod.yaml
[k8s-master]# kubectl get pod
The integration now supports also live expansion of the filesystem. In order to
trigger a live expansion use kubectl edit pvc my-storpool-csi-request and
bump the size in spec -> resources -> requests -> storage.
Note
Use kubectl exec -it task-pv-pod -- /bin/sh -c "kill 1" if you’d like to
restart the container and update the size immediately.