Kubernetes hostPath PersistentVolume和spec.capacity.storage属性
我在虚拟机中运行单个主/节点Kubernetes,使用Kubernetes hostPath PersistentVolume和spec.capacity.storage属性,kubernetes,persistent-volumes,Kubernetes,Persistent Volumes,我在虚拟机中运行单个主/节点Kubernetes,使用hostPath作为已部署Postgres数据库的持久卷 MyPersistentVolume具有以下配置: apiVersion: v1 kind: PersistentVolume metadata: annotations: volume.beta.kubernetes.io/storage-class: postgres labels: type: local name: postgres-storage
hostPath
作为已部署Postgres数据库的持久卷
MyPersistentVolume
具有以下配置:
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
volume.beta.kubernetes.io/storage-class: postgres
labels:
type: local
name: postgres-storage
spec:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
hostPath:
path: /data/postgres
另外,我有一个PersistentVolumeClaim
当前绑定到该卷,请求所有容量(spec.resources.requests.storage:1Gi
)
最近,Postgres数据库的大小超过了spec.capacity.storage
,但没有造成任何问题:
$ du -hs /data/postgres # Powers of 1024
1.2G /data/postgres
$ du -hs /data/postgres --si # Powers of 1000
1.3G /data/postgres
我的问题是:
- 使用
卷,或者该卷实际上由底层分区占用 尺寸主机路径
- 当卷使用量超过其
容量时会发生什么情况?(即Kubernetes将如何处理)
emptyDir
或hostPath
卷可以占用的空间没有限制
消耗,容器之间或豆荚之间无隔离
在未来,我们预计emptyDir和hostPath卷将
能够使用资源请求一定数量的空间
规范,并为群集选择要使用的媒体类型
有多种媒体类型
哦,我明白了……在进一步调查之后,我甚至发现了
主机路径卷中的容量
注意事项。我冒昧地编辑了您的答案以添加此信息。