Skip to content

Instantly share code, notes, and snippets.

@ShyamsundarR
Created May 20, 2019 22:06
Show Gist options
  • Save ShyamsundarR/1009b79966992470f588a277429ae2e1 to your computer and use it in GitHub Desktop.
Save ShyamsundarR/1009b79966992470f588a277429ae2e1 to your computer and use it in GitHub Desktop.
Static PV using CephFS CSI
---
# Secret manifest containing ID and key for pre-provisioned subvolume
apiVersion: v1
kind: Secret
metadata:
name: csi-cephfs-preprov-secret
namespace: default
data:
userID: YWRtaW4=
userKey: QVFDNTBOQmN1c0hZR0JBQUptU0xtOUF3OThtQlJUNUZ5ZVMxL3c9PQ==
---
# Static persistent volume manifest
apiVersion: v1
kind: PersistentVolume
metadata:
name: preprov-pv-cephfs-01
spec:
accessModes:
- ReadWriteMany
capacity:
storage: 5Gi
csi:
driver: cephfs.csi.ceph.com
fsType: ext4
nodeStageSecretRef:
name: csi-cephfs-preprov-secret
namespace: default
volumeAttributes:
# New style monitors and FSName specification 1.1.0 (instead of monitors and pool)
clusterID: rookcluster
fsName: myfs
# Denote the volume as pre-provisioned for the nodeplugin to act appropriately
preProvisionedVolume: "true"
rootPath: /preprov/path1
volumeHandle: preprov-pv-cephfs-01
# reclaim policy is to retain, as it is a pre-provisioned volume and would require a PV delete
# to remove the same from the kubernetes system
persistentVolumeReclaimPolicy: Retain
volumeMode: Filesystem
# claimref tying this PV to a specific PV and namespace
claimRef:
name: csi-cephfs-pvc-preprov
namespace: default
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-cephfs-pvc-preprov
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
# volumeName tying this PCV to a specific PV
volumeName: preprov-pv-cephfs-01
---
apiVersion: v1
kind: Pod
metadata:
name: csicephfs-preprov-demo-pod
spec:
containers:
- name: web-server
image: nginx
volumeMounts:
- name: mypvc
mountPath: /var/lib/www
volumes:
- name: mypvc
persistentVolumeClaim:
claimName: csi-cephfs-pvc-preprov
readOnly: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment