问题描述
通过遵循kubernetes指南,我创建了一个pv,pvc和pod.我只要求20Mi pv中有10Mi.我复制的23Mi比我的PV还要多.但是我的吊舱仍在运行.有人可以解释吗?
By following kubernetes guide i have created a pv, pvc and pod. i have claimed only 10Mi of out of 20Mi pv. I have copied 23Mi that is more than my pv. But my pod is still running. Can any one explain ?
pv-volume.yaml
pv-volume.yaml
kind: PersistentVolume
apiVersion: v1
metadata:
name: task-pv-volume
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 20Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
pv-claim.yaml
pv-claim.yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: task-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Mi
pv-pod.yaml
pv-pod.yaml
kind: Pod
apiVersion: v1
metadata:
name: task-pv-pod
spec:
volumes:
- name: task-pv-storage
persistentVolumeClaim:
claimName: task-pv-claim
containers:
- name: task-pv-container
image: nginx
ports:
- containerPort: 80
name: "http-server"
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: task-pv-storage
推荐答案
可能您可以使用任何已应用的POD存储将尽可能多的数据复制到共享存储/mnt/data (在活动节点上)中,/usr/share/nginx/html ,在节点和pod之间共享,直到您的节点停止响应为止.
Probably you can copy as much data into shared storage /mnt/data (on your active node) using any of applied POD's storages ,/usr/share/nginx/html, shared between node and pods till your node will stop responding.
如果您需要在更真实的条件下进行测试,可以考虑使用 GlusterFS , nfs-utils 创建NFS持久性存储,或挂载原始分区文件用 dd 制成.
In case you need to test this scenario in more real conditions could you please consider create NFS persistent storage using GlusterFS, nfs-utils, or mount a raw partition file made with dd.
在Minikube中,节点使用临时存储.有关节点/吊舱资源的详细信息,您可以在这里找到:
In Minikube nodes are using ephemeral-storages. Detailed information about node/pod resources you can find here:
https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable
希望有帮助.
https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/#node-allocatable
Hope this help.
这篇关于kubernetes持久性卷和持久性卷声明超出存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!