primo
This commit is contained in:
118
add-on/CephCsi.txt
Normal file
118
add-on/CephCsi.txt
Normal file
@@ -0,0 +1,118 @@
|
||||
kubectl create namespace ceph-csi
|
||||
|
||||
git clone https://github.com/ceph/ceph-csi.git
|
||||
cd ceph-csi
|
||||
git checkout v3.15.0
|
||||
# move to rbd chart.
|
||||
cd charts/ceph-csi-rbd
|
||||
|
||||
cat <<EOF > ceph-csi-rbd-values.yaml
|
||||
csiConfig:
|
||||
- clusterID: "004ee854-86cc-4ddc-b7d6-75e4fe962296"
|
||||
monitors:
|
||||
- "172.20.1.33:6789"
|
||||
- "172.20.1.34:6789"
|
||||
- "172.20.1.35:6789"
|
||||
|
||||
provisioner:
|
||||
name: provisioner
|
||||
replicaCount: 2
|
||||
EOF
|
||||
|
||||
|
||||
helm install --namespace ceph-csi ceph-csi --values ceph-csi-rbd-values.yaml ./
|
||||
|
||||
Examples on how to configure a storage class and start using the driver are here:
|
||||
https://github.com/ceph/ceph-csi/tree/devel/examples/rbd
|
||||
|
||||
|
||||
echo "kubernetes" | tr -d '\n' | base64
|
||||
a3ViZXJuZXRlcw==
|
||||
|
||||
cat > ceph-admin-secret.yaml << EOF
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: csi-rbd-secret
|
||||
namespace: default
|
||||
stringData:
|
||||
userID: kubernetes
|
||||
userKey: AQD2zo5pm8aZIRAAPzWS+dROeX7iJtv5EukfKA==
|
||||
EOF
|
||||
|
||||
# create a secret for admin user.
|
||||
kubectl apply -f ceph-admin-secret.yaml
|
||||
|
||||
|
||||
|
||||
----- Create StorageClass ------
|
||||
|
||||
cat > ceph-rbd-sc.yaml <<EOF
|
||||
apiVersion: storage.k8s.io/v1
|
||||
kind: StorageClass
|
||||
metadata:
|
||||
name: ceph-rbd-sc
|
||||
annotations:
|
||||
storageclass.kubernetes.io/is-default-class: "true"
|
||||
provisioner: rbd.csi.ceph.com
|
||||
parameters:
|
||||
clusterID: 004ee854-86cc-4ddc-b7d6-75e4fe962296
|
||||
pool: k8s-rbd
|
||||
imageFeatures: layering
|
||||
csi.storage.k8s.io/provisioner-secret-name: csi-rbd-secret
|
||||
csi.storage.k8s.io/provisioner-secret-namespace: default
|
||||
csi.storage.k8s.io/controller-expand-secret-name: csi-rbd-secret
|
||||
csi.storage.k8s.io/controller-expand-secret-namespace: default
|
||||
csi.storage.k8s.io/node-stage-secret-name: csi-rbd-secret
|
||||
csi.storage.k8s.io/node-stage-secret-namespace: default
|
||||
reclaimPolicy: Delete
|
||||
allowVolumeExpansion: true
|
||||
mountOptions:
|
||||
- discard
|
||||
EOF
|
||||
|
||||
# create a storage class
|
||||
kubectl apply -f ceph-rbd-sc.yaml;
|
||||
|
||||
|
||||
--- test
|
||||
|
||||
cat <<EOF > create-ceph-pvc.yaml
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: raw-block-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
volumeMode: Block
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
storageClassName: csi-rbd-sc
|
||||
EOF
|
||||
|
||||
# create pvc
|
||||
kubectl apply -f create-ceph-pvc.yaml
|
||||
|
||||
cat <<EOF > create-pod-with-pvc.yaml
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ceph-pod-pvc
|
||||
spec:
|
||||
containers:
|
||||
- name: ceph-pod-pvc
|
||||
image: busybox
|
||||
command: ["sleep", "infinity"]
|
||||
volumeMounts:
|
||||
- mountPath: /mnt/ceph_rbd
|
||||
name: volume
|
||||
volumes:
|
||||
- name: volume
|
||||
persistentVolumeClaim:
|
||||
claimName: raw-block-pvc
|
||||
EOF
|
||||
|
||||
# create pod
|
||||
kubectl apply -f create-pod-with-pvc.yaml
|
||||
Reference in New Issue
Block a user