Skip to content

Commit 7d4b674

Browse files
authored
Merge pull request #56 from vladimirvivien/csi-inline-doc
Doc update for CSI inline ephemeral feature
2 parents 1f26dd2 + 0d70215 commit 7d4b674

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,60 @@ Follow the following example to create a volume from a volume snapshot:
341341
> pvc-77324684-c717-11e8-8911-000c2967769a 1Gi RWO Delete Bound default/hpvc-restore csi-hostpath-sc 33s
342342
> ```
343343
344+
## Inline ephemeral support
345+
As of version 1.15 of Kubernetes, the CSI Hostpath driver (starting with version 1.0.1) now includes support for inline ephemeral volume. This means that a volume can be specified directly inside a pod spec without the need to use a persistent volume object.
346+
Find out how to enable or create a CSI inline driver [here](https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html)
347+
348+
To test this feature, redeploy the CSI Hostpath plugin YAML by updating the `hostpath` container to use the inline ephemeral mode by setting the `ephemeral` flag, of the driver binary, to true as shown in the following setup:
349+
350+
```yaml
351+
kind: DaemonSet
352+
apiVersion: apps/v1
353+
metadata:
354+
name: csi-hostpathplugin
355+
spec:
356+
...
357+
template:
358+
spec:
359+
containers:
360+
- name: hostpath
361+
image: image: quay.io/k8scsi/hostpathplugin:v1.2.0
362+
args:
363+
- "--v=5"
364+
- "--endpoint=$(CSI_ENDPOINT)"
365+
- "--nodeid=$(KUBE_NODE_NAME)"
366+
- "--ephemeral=true"
367+
...
368+
369+
```
370+
Notice the addition of the `ephemeral=true` flag used in the `args:` block in the previous snippet.
371+
372+
Once the driver plugin has been deployed, it can be tested by deploying a simple pod which has an inline volume specified in the spec:
373+
374+
```yaml
375+
kind: Pod
376+
apiVersion: v1
377+
metadata:
378+
name: my-csi-app
379+
spec:
380+
containers:
381+
- name: my-frontend
382+
image: busybox
383+
volumeMounts:
384+
- mountPath: "/data"
385+
name: my-csi-volume
386+
command: [ "sleep", "1000000" ]
387+
volumes:
388+
- name: my-csi-volume
389+
csi:
390+
driver: csi-hostpath
391+
```
392+
393+
> See sample YAML file [here](./examples/csi-app-inline.yaml).
394+
395+
Notice the CSI driver is now specified directly in the container spec inside the `volumes:` block. You can use the [same steps as above][Confirm Hostpath driver works]
396+
to verify that the volume has been created and deleted (when the pod is removed).
397+
344398

345399
## Building the binaries
346400
If you want to build the driver yourself, you can do so with the following command from the root directory:

examples/csi-app-inline.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
kind: Pod
2+
apiVersion: v1
3+
metadata:
4+
name: my-csi-app
5+
spec:
6+
containers:
7+
- name: my-frontend
8+
image: busybox
9+
volumeMounts:
10+
- mountPath: "/data"
11+
name: my-csi-volume
12+
command: [ "sleep", "1000000" ]
13+
volumes:
14+
- name: my-csi-volume
15+
csi:
16+
driver: csi-hostpath

0 commit comments

Comments
 (0)