From 995edf1ac5b1a3e18e8b8682ea97f3d3fc3cf157 Mon Sep 17 00:00:00 2001 From: Vladimir Vivien Date: Tue, 4 Jun 2019 14:09:32 -0400 Subject: [PATCH 1/3] Doc and example update for CSI inline ephemeral volumes --- README.md | 60 ++++++++++++++++++++++++++++++++++++ examples/csi-app-inline.yaml | 16 ++++++++++ 2 files changed, 76 insertions(+) create mode 100644 examples/csi-app-inline.yaml diff --git a/README.md b/README.md index 3d3fcb273..7aae1daa8 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,66 @@ Follow the following example to create a volume from a volume snapshot: > pvc-77324684-c717-11e8-8911-000c2967769a 1Gi RWO Delete Bound default/hpvc-restore csi-hostpath-sc 33s > ``` +## Inline ephemeral support +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 +inside a pod spec without the need to use a persistent volume object. Find more detail about the design of this feature +[here](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md). + +You will need to enable the feature gate `CSIInlineVolume` when starting your Kubernets binary components: +``` +CSIInlineVolume=true +``` + +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: + +```yaml +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-hostpathplugin +spec: +... + template: + spec: + containers: + - name: hostpath + image: image: quay.io/k8scsi/hostpathplugin:v1.2.0 + args: + - "--v=5" + - "--endpoint=$(CSI_ENDPOINT)" + - "--nodeid=$(KUBE_NODE_NAME)" + - "--ephemeral=true" +... + +``` +Notice the addition of the `ephemeral=true` flag used in the `args:` block in the previous snippet. + +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: + +```yaml +kind: Pod +apiVersion: v1 +metadata: + name: my-csi-app +spec: + containers: + - name: my-frontend + image: busybox + volumeMounts: + - mountPath: "/data" + name: my-csi-volume + command: [ "sleep", "1000000" ] + volumes: + - name: my-csi-volume + csi: + driver: csi-hostpath +``` + +> See sample YAML file [here](./examples/csi-app-inline.yaml). + +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] +to verify that the volume has been created and deleted (when the pod is removed). + ## Building the binaries If you want to build the driver yourself, you can do so with the following command from the root directory: diff --git a/examples/csi-app-inline.yaml b/examples/csi-app-inline.yaml new file mode 100644 index 000000000..ca88e9875 --- /dev/null +++ b/examples/csi-app-inline.yaml @@ -0,0 +1,16 @@ +kind: Pod +apiVersion: v1 +metadata: + name: my-csi-app +spec: + containers: + - name: my-frontend + image: busybox + volumeMounts: + - mountPath: "/data" + name: my-csi-volume + command: [ "sleep", "1000000" ] + volumes: + - name: my-csi-volume + csi: + driver: csi-hostpath \ No newline at end of file From 3283aca7b2a0dab6c38a595abf090b334b6a03af Mon Sep 17 00:00:00 2001 From: Vladimir Vivien Date: Mon, 17 Jun 2019 20:42:58 -0400 Subject: [PATCH 2/3] First round review/updates --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7aae1daa8..d8b133da6 100644 --- a/README.md +++ b/README.md @@ -342,13 +342,12 @@ Follow the following example to create a volume from a volume snapshot: > ``` ## Inline ephemeral support -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 -inside a pod spec without the need to use a persistent volume object. Find more detail about the design of this feature -[here](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md). +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. +Find out how to enable or create a CSI inline driver [here](https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html) You will need to enable the feature gate `CSIInlineVolume` when starting your Kubernets binary components: ``` -CSIInlineVolume=true +--feature-gates=CSIInlineVolume=true ``` 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: From 0d702152ec4246336e8574e018ceb33bacb122a9 Mon Sep 17 00:00:00 2001 From: Vladimir Vivien Date: Fri, 21 Jun 2019 14:13:56 -0400 Subject: [PATCH 3/3] Remove feature-gates instruction per suggestion --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index d8b133da6..6a2fbb2fe 100644 --- a/README.md +++ b/README.md @@ -345,11 +345,6 @@ Follow the following example to create a volume from a volume snapshot: 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. Find out how to enable or create a CSI inline driver [here](https://kubernetes-csi.github.io/docs/ephemeral-local-volumes.html) -You will need to enable the feature gate `CSIInlineVolume` when starting your Kubernets binary components: -``` ---feature-gates=CSIInlineVolume=true -``` - 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: ```yaml