|
| 1 | +## CSI driver E2E usage example |
| 2 | +create a pod with blobfuse mount on linux |
| 3 | +### Dynamic Provisioning (create storage account and container automatically by blobfuse driver) |
| 4 | + - Create a blobfuse CSI storage class |
| 5 | +```sh |
| 6 | +kubectl create -f https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/storageclass-blobfuse-csi-mountoptions.yaml |
| 7 | +``` |
| 8 | + |
| 9 | + - Create a blobfuse CSI PVC |
| 10 | +```sh |
| 11 | +kubectl create -f https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/pvc-blobfuse-csi.yaml |
| 12 | +``` |
| 13 | + |
| 14 | +### Static Provisioning(use an existing storage account) |
| 15 | +#### Option#1: use existing credentials in k8s cluster |
| 16 | + > make sure the existing credentials in k8s cluster(e.g. service principal, msi) could access the specified storage account |
| 17 | + - Download a blobfuse CSI storage class, edit `resourceGroup`, `storageAccount`, `containerName` in storage class |
| 18 | +```sh |
| 19 | +wget https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/storageclass-blobfuse-csi-existing-container.yaml |
| 20 | +vi storageclass-blobfuse-csi-existing-container.yaml |
| 21 | +kubectl create -f storageclass-blobfuse-csi-existing-container.yaml |
| 22 | +``` |
| 23 | + |
| 24 | + - Create a blobfuse CSI PVC |
| 25 | +```sh |
| 26 | +kubectl create -f https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/pvc-blobfuse-csi.yaml |
| 27 | +``` |
| 28 | + |
| 29 | +#### Option#2: provide storage account name and key(or sastoken) |
| 30 | + - Use `kubectl create secret` to create `azure-secret` with existing storage account name and key(or sastoken) |
| 31 | +``` |
| 32 | +kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountkey="KEY" --type=Opaque |
| 33 | +#kubectl create secret generic azure-secret --from-literal azurestorageaccountname=NAME --from-literal azurestorageaccountsastoken |
| 34 | +="sastoken" --type=Opaque |
| 35 | +``` |
| 36 | + |
| 37 | +> storage account key(or sastoken) could also be stored in Azure Key Vault, check example here: [read-from-keyvault](./docs/read-from-keyvault.md) |
| 38 | +
|
| 39 | + - Create a blobfuse CSI PV, download `pv-blobfuse-csi.yaml` file and edit `containerName` in `volumeAttributes` |
| 40 | +```sh |
| 41 | +wget https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/pv-blobfuse-csi.yaml |
| 42 | +vi pv-blobfuse-csi.yaml |
| 43 | +kubectl create -f pv-blobfuse-csi.yaml |
| 44 | +``` |
| 45 | + |
| 46 | + - Create a blobfuse CSI PVC which would be bound to the above PV |
| 47 | +``` |
| 48 | +kubectl create -f https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/pvc-blobfuse-csi-static.yaml |
| 49 | +``` |
| 50 | + |
| 51 | +#### 2. Validate PVC status and create an nginx pod |
| 52 | + > make sure pvc is created and in `Bound` status |
| 53 | +``` |
| 54 | +watch kubectl describe pvc pvc-blobfuse |
| 55 | +``` |
| 56 | + |
| 57 | + - create a pod with blobfuse CSI PVC |
| 58 | +``` |
| 59 | +kubectl create -f https://raw.githubusercontent.com/csi-driver/blobfuse-csi-driver/master/deploy/example/nginx-pod-blobfuse.yaml |
| 60 | +``` |
| 61 | + |
| 62 | +#### 3. enter the pod container to do validation |
| 63 | + - watch the status of pod until its Status changed from `Pending` to `Running` and then enter the pod container |
| 64 | +```sh |
| 65 | +$ watch kubectl describe po nginx-blobfuse |
| 66 | +$ kubectl exec -it nginx-blobfuse -- bash |
| 67 | +Filesystem Size Used Avail Use% Mounted on |
| 68 | +... |
| 69 | +blobfuse 30G 8.9G 21G 31% /mnt/blobfuse |
| 70 | +/dev/sda1 30G 8.9G 21G 31% /etc/hosts |
| 71 | +... |
| 72 | +``` |
| 73 | +In the above example, there is a `/mnt/blobfuse` directory mounted as `blobfuse` filesystem. |
0 commit comments