Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph: support ephemeral volumes with Ceph CSI RBD and CephFS driver #9055

Merged
merged 1 commit into from Nov 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 37 additions & 1 deletion Documentation/ceph-csi-drivers.md
Expand Up @@ -3,7 +3,7 @@ title: Ceph CSI
weight: 3200
indent: true
---

{% include_relative branch.liquid %}
# Ceph CSI Drivers

There are two CSI drivers integrated with Rook that will enable different scenarios:
Expand Down Expand Up @@ -92,3 +92,39 @@ kubectl create -f https://raw.githubusercontent.com/csi-addons/volume-replicatio
2. Enable the volume replication controller:
- For Helm deployments see the [csi.volumeReplication.enabled setting](helm-operator.md#configuration).
- For non-Helm deployments set `CSI_ENABLE_VOLUME_REPLICATION: "true"` in operator.yaml

## Ephemeral volume support

The generic ephemeral volume feature adds support for specifying PVCs in the
`volumes` field to indicate a user would like to create a Volume as part of the pod spec.
This feature requires the GenericEphemeralVolume feature gate to be enabled.
humblec marked this conversation as resolved.
Show resolved Hide resolved

For example:

```yaml
kind: Pod
humblec marked this conversation as resolved.
Show resolved Hide resolved
apiVersion: v1
...
volumes:
- name: mypvc
ephemeral:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "rook-ceph-block"
resources:
requests:
storage: 1Gi
```

A volume claim template is defined inside the pod spec which refers to a volume
provisioned and used by the pod with its lifecycle. The volumes are provisioned
when pod get spawned and destroyed at time of pod delete.

humblec marked this conversation as resolved.
Show resolved Hide resolved
Refer to [ephemeral-doc]( https://kubernetes.io/docs/concepts/storage/ephemeral-volumes/#generic-ephemeral-volumes )
for more info. Also, See the example manifests for an [RBD ephemeral volume]
(https://github.com/rook/rook/tree/{{ branchName }}/cluster/examples/kubernetes/ceph/csi/rbd/pod-ephemeral.yaml)
and a [CephFS ephemeral volume](https://github.com/rook/rook/tree/{{ branchName }}/cluster/examples/kubernetes/ceph/csi/cephfs/pod-ephemeral.yaml).

### Prerequisites
Kubernetes version 1.21 or greater is required.
21 changes: 21 additions & 0 deletions cluster/examples/kubernetes/ceph/csi/cephfs/pod-ephemeral.yaml
@@ -0,0 +1,21 @@
kind: Pod
apiVersion: v1
metadata:
name: csi-cephfs-demo-ephemeral-pod
spec:
containers:
- name: web-server
image: docker.io/library/nginx:latest
volumeMounts:
- mountPath: "/myspace"
name: mypvc
volumes:
- name: mypvc
ephemeral:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteMany"]
storageClassName: "rook-cephfs"
resources:
requests:
storage: 1Gi
21 changes: 21 additions & 0 deletions cluster/examples/kubernetes/ceph/csi/rbd/pod-ephemeral.yaml
@@ -0,0 +1,21 @@
kind: Pod
apiVersion: v1
metadata:
name: csi-rbd-demo-ephemeral-pod
spec:
containers:
- name: web-server
image: docker.io/library/nginx:latest
volumeMounts:
- mountPath: "/myspace"
name: mypvc
volumes:
- name: mypvc
ephemeral:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "rook-ceph-block"
resources:
requests:
storage: 1Gi