kubernetes的ceph RBD volume(2): 使用Ceph RBD作为persistent volume
来源:互联网 发布:刘雨晴淘宝卖假货 编辑:程序博客网 时间:2024/05/16 08:23
以下是使用ceph RBD作为persistent volume的例子:
A PersistentVolume
(PV) is a piece of networked storage in the cluster that has been provisioned by an administrator. It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.
A PersistentVolumeClaim
(PVC) is a request for storage by a user. It is similar to a pod. Pods consume node resources and PVCs consume PV resources. Pods can request specific levels of resources (CPU and Memory). Claims can request specific size and access modes (e.g., can be mounted once read/write or many times read-only).
1. 先创建image在pool里。
2. 创建 PV
[root@testnew kube]# cat pv_ceph.yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: ceph-pv
spec:
capacity:
storage: 50Gi
accessModes:
- ReadWriteOnce
rbd:
monitors:
- 10.0.200.11:6789
- 10.0.200.13:6789
- 10.0.200.14:6789
pool: kube
image: vol2
user: kube
secretRef:
name: ceph-secret
fsType: ext4
readOnly: false
persistentVolumeReclaimPolicy: Recycle
kubectl create -f pv_ceph.yaml
[root@testnew kube]# kubectl get pv
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM REASON AGE
ceph-pv 50Gi RWO Recycle Bound default/ceph-claim 4d
pvc-ac668f99-3b8b-11e7-8af9-fa163e01317b 20Gi RWO Delete Bound default/ceph-claim-sc 4d
3. 创建pvc
[root@testnew kube]# cat pvc_ceph.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: ceph-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 20Gi
note: pvc和pv是一一对应的,所以storage在这设20G没用
kubectl create -f pvc_ceph.yaml
[root@testnew kube]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESSMODES AGE
ceph-claim Bound ceph-pv 50Gi RWO 4d
4. 创建pod
[root@testnew kube]# cat frontend-pvc-controller.yaml
apiVersion: v1
kind: ReplicationController
metadata:
name: frontendpvc
labels:
name: frontendpvc
spec:
replicas: 1
selector:
name: frontendpvc
template:
metadata:
labels:
name: frontendpvc
spec:
containers:
- name: frontendpvc
image: kubeguide/guestbook-php-frontend
env:
- name: GET_HOSTS_FROM
value: env
ports:
- containerPort: 80
volumeMounts:
- mountPath: /mnt/rbd
name: ceph-vol
volumes:
- name: ceph-vol
persistentVolumeClaim:
claimName: ceph-claim
- kubernetes的ceph RBD volume(2): 使用Ceph RBD作为persistent volume
- kubernetes的ceph RBD volume(1):使用Ceph RBD作为后端Volume
- kubernetes的ceph RBD volume(3): 动态volume的使用(ceph RBD)
- kubernetes的ceph RBD volume(4): 性能测试
- kubernetes使用ceph rbd存储
- kubernetes的ceph RBD volume(5): 创建动态的volume绑定随replica scale的扩容和缩容的pod
- CEPH RBD集群使用
- k8s使用ceph rbd
- iscsi协议使用ceph rbd
- kubernetes 挂载ceph rbd源码解析
- Ceph学习----Ceph rbd 作为设备挂载到本地
- Ceph rbd cmd练习
- ceph之rbd-nbd
- ceph rbd 对象组成
- Ceph rbd写入数据
- Ceph-rbd排错
- openstack&ceph配置使用rbd cache
- 通过iscsi协议使用ceph rbd
- JAVA注解
- powerdesigner 表怎么在其他模块引用
- jqueryMobile 过度
- 选择主键:自然键还是代理键?
- 获取验证码的URL后边要加上一个不断变化的参数
- kubernetes的ceph RBD volume(2): 使用Ceph RBD作为persistent volume
- 【五大布局】Android五大布局详解
- lua cocos 中对FNT字体的使用
- Java 试题二
- Codeforces Round #415 (Div. 2) A. Straight «A»
- 解压rpm包
- iOS与js交互
- 在Android中使用SVG图遇到的坑
- 汇编--学习笔记(二)-寻址方式