首页 > 其他 > 详细

Ceph 与 PV/PVC 集成

时间:2021-05-21 09:42:26      阅读:26      评论:0      收藏:0      [点我收藏+]
ceph osd lspools

rbd create -p kubernetes --image-feature layering demo-1.img --size 5G

rbd -p kubernetes ls

mkdir -p /data/pv_pvc
cd /data/pv_pvc

# 创建 pv.yaml
vi pv.yaml 
apiVersion: v1
kind: PersistentVolume
metadata:
  name: rbd-demo
spec:
  accessModes:
   - ReadWriteOnce
  capacity:
    storage: 5G
  rbd:
    monitors:
     - 192.168.31.207:6789
     - 192.168.31.159:6789
     - 192.168.31.198:6789
    pool: kubernetes
    image: demo-1.img 
    fsType: ext4
    user: kubernetes
    secretRef:
      name: ceph-secret
  persistentVolumeReclaimPolicy: Retain
  storageClassName: rbd


kubectl apply -f pv.yaml

# 定义 PVC,引用 PV
vi pvc.yaml 
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-demo
spec:
  accessModes:
   - ReadWriteOnce
  volumeName: rbd-demo
  resources:
    requests:
      storage: 5G
  storageClassName: rbd

kubectl apply -f pvc.yaml

kubectl get pvc

# Pod 中引用 PVC
vi pod-demo.yaml 
apiVersion: v1
kind: Pod
metadata:
  name: pod-demo-pv-pvc
spec:
  containers:
  - name: pod-demo-pv-pvc
    image: nginx:1.7.9
    imagePullPolicy: IfNotPresent
    ports:
    - name: www
      protocol: TCP
      containerPort: 80
    volumeMounts:
    - name: rbd
      mountPath: /data
  volumes:
  - name: rbd
    persistentVolumeClaim:
      claimName: pvc-demo

kubectl apply -f pod-demo.yaml 

技术分享图片
技术分享图片

Ceph 与 PV/PVC 集成

原文:https://www.cnblogs.com/klvchen/p/14791967.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!