Launch an application using WEKA as the POD's storage
Once a storage class and a PVC are in place, you can configure the Kubernetes pods to provision volumes via the WEKA system.
We'll take an example application that echos the current timestamp every 10 seconds and provide it with the previously created pvc-wekafs-dir PVC.
Note that multiple pods can share a volume produced by the same PVC as long as the accessModes parameter is set to ReadWriteMany.
kind: Pod
apiVersion: v1
metadata:
name: my-csi-app
spec:
containers:
- name: my-frontend
image: busybox
volumeMounts:
- mountPath: "/data"
name: my-csi-volume
command: ["/bin/sh"]
args: ["-c", "while true; do echo `date` >> /data/temp.txt; sleep 10;done"]
volumes:
- name: my-csi-volume
persistentVolumeClaim:
claimName: pvc-wekafs-dir # defined in pvc-wekafs-dir.yamlCreate the pod by applying manifest:
Kubernetes allocates a persistent volume and attach it to the pod, it uses a directory within the WEKA filesystem as defined in the storage class mentioned in the persistent volume claim. The pod is in Running status, and the temp.txt file is updated with occasional date information.