Skip to content

Commit 995edf1

Browse files
author
Vladimir Vivien
committed
Doc and example update for CSI inline ephemeral volumes
1 parent 1f26dd2 commit 995edf1

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,66 @@ 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, the CSI Hostpath driver now includes support for inline ephemeral volume. This means that a volume can be specified directly
346+
inside a pod spec without the need to use a persistent volume object. Find more detail about the design of this feature
347+
[here](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md).
348+
349+
You will need to enable the feature gate `CSIInlineVolume` when starting your Kubernets binary components:
350+
```
351+
CSIInlineVolume=true
352+
```
353+
354+
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:
355+
356+
```yaml
357+
kind: DaemonSet
358+
apiVersion: apps/v1
359+
metadata:
360+
name: csi-hostpathplugin
361+
spec:
362+
...
363+
template:
364+
spec:
365+
containers:
366+
- name: hostpath
367+
image: image: quay.io/k8scsi/hostpathplugin:v1.2.0
368+
args:
369+
- "--v=5"
370+
- "--endpoint=$(CSI_ENDPOINT)"
371+
- "--nodeid=$(KUBE_NODE_NAME)"
372+
- "--ephemeral=true"
373+
...
374+
375+
```
376+
Notice the addition of the `ephemeral=true` flag used in the `args:` block in the previous snippet.
377+
378+
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:
379+
380+
```yaml
381+
kind: Pod
382+
apiVersion: v1
383+
metadata:
384+
name: my-csi-app
385+
spec:
386+
containers:
387+
- name: my-frontend
388+
image: busybox
389+
volumeMounts:
390+
- mountPath: "/data"
391+
name: my-csi-volume
392+
command: [ "sleep", "1000000" ]
393+
volumes:
394+
- name: my-csi-volume
395+
csi:
396+
driver: csi-hostpath
397+
```
398+
399+
> See sample YAML file [here](./examples/csi-app-inline.yaml).
400+
401+
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]
402+
to verify that the volume has been created and deleted (when the pod is removed).
403+
344404

345405
## Building the binaries
346406
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)