可是,你有没有想过这样一个场景:如果你并不知道有哪些 Volume 类型可以用,要怎么
办呢?
更具体地说,作为一个应用开发者,我可能对持久化存储项目(比如 Ceph、GlusterFS
等)一窍不通,也不知道公司的 Kubernetes 集群里到底是怎么搭建出来的,我也自然不
会编写它们对应的 Volume 定义文件。
所谓“术业有专攻”,这些关于 Volume 的管理和远程持久化存储的知识,不仅超越了开
发者的知识储备,还会有暴露公司基础设施秘密的风险。
比如,下面这个例子,就是一个声明了 Ceph RBD 类型 Volume 的 Pod:
其一,如果不懂得 Ceph RBD 的使用方法,那么这个 Pod 里 Volumes 字段,你十有八九
也完全看不懂。其二,这个 Ceph RBD 对应的存储服务器的地址、用户名、授权文件的位
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
apiVersion: v1
kind: Pod
metadata:
name: rbd
spec:
containers:
- image: kubernetes/pause
name: rbd-rw
volumeMounts:
- name: rbdpd
mountPath: /mnt/rbd
volumes:
- name: rbdpd
rbd:
monitors:
- '10.16.154.78:6789'
- '10.16.154.82:6789'
- '10.16.154.83:6789'
pool: kube
image: foo
fsType: ext4
readOnly: true
user: admin
keyring: /etc/ceph/keyring
imageformat: "2"
imagefeatures: "layering"
文档被以下合辑收录
评论