-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathkube-create-pvc.sh
executable file
·61 lines (54 loc) · 1.17 KB
/
kube-create-pvc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Create a Persistent Volume Claim on a Kubernetes cluster.
# parse command-line arguments
if [[ $# != 1 ]]; then
echo "usage: $0 <pvc-name>"
exit -1
fi
PVC_NAME="$1"
PVC_FILE="pvc.yaml"
NAMESPACE="deepgtex-prp"
STORAGE="1TiB"
# create PV claim
cat > ${PVC_FILE} <<EOF
kind: PersistentVolume
apiVersion: v1
metadata:
name: ${PVC_NAME}-volume
spec:
storageClassName: manual
capacity:
storage: ${STORAGE}
accessModes:
- ReadWriteMany
flexVolume:
driver: ceph.rook.io/rook
fsType: ceph
options:
clusterNamespace: rook
fsName: nautilusfs
path: /${NAMESPACE}
mountUser: ${NAMESPACE}
mountSecret: ceph-fs-secret
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ${PVC_NAME}
spec:
volumeName: ${PVC_NAME}-volume
storageClassName: manual
accessModes:
- ReadWriteMany
resources:
requests:
storage: ${STORAGE}
EOF
kubectl create -f ${PVC_FILE}
# display PV claim
kubectl get pvc
# delete PV claim
# kubectl delete -f ${PVC_FILE}
# rm -f ${PVC_FILE}
# create secret for cephfs shared filesystem
# kubectl create secret -n <namespace> generic ceph-fs-secret --from-literal=key=<secret-key>