热路径是否保留了指定数量的节点存储空间?

huangapple go评论57阅读模式
英文:

Does hotPath reserve specified amount of storage in node

问题

以下是您要翻译的内容:

我有一个静态的PV规范,使用hostPath。

apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysqlvol
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi #卷的大小
  accessModes:
    - ReadWriteOnce #访问类型 # RWO RWX ROX
  hostPath:
    path: "/tmp/new.txt" #主机位置

在节点上,我在/tmp下看不到10Gi的存储空间。存储是如何为hostPath保留的。

pvc规范

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysqlvol
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi # < 10Gi

pod规范

apiVersion: v1
kind: Pod
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
        claimName: mysqlvol
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: &quot;http-server&quot;
      volumeMounts:
        - mountPath: &quot;/usr/share/nginx/html&quot;
          name: task-pv-storage

我能够写入超过10GiB的数据。

root@task-pv-pod:/usr/share/nginx/html# ls -lh
total 15G
-rw-r--r-- 1 root root 15G May 22 04:16 bigfile.txt
-rw-r--r-- 1 root root   3 May 18 12:04 new.txt
root@task-pv-pod:/usr/share/nginx/html#   
  1. 这里的10GiB的相关性是什么,因为我可以在卷中写入任意数量的数据[15GiB也可以]?
  2. 为什么当请求大小大于10GiB时PVC创建失败,考虑到卷能够容纳更大的大小?
英文:

I have a static PV spec, using hostPath.

apiVersion: v1
kind: PersistentVolume
metadata:
  name: mysqlvol
spec:
  storageClassName: manual
  capacity:
    storage: 10Gi #Size of the volume
  accessModes:
    - ReadWriteOnce #type of access # RWO RWX ROX
  hostPath:
    path: &quot;/tmp/new.txt&quot; #host location

In the node I don't see 10Gi of storage under /tmp.
How is storage reserved for hostPath.

pvc spec

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysqlvol
spec:
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi # &lt; 10Gi

pod spec

apiVersion: v1
kind: Pod
metadata:
  name: task-pv-pod
spec:
  volumes:
    - name: task-pv-storage
      persistentVolumeClaim:
        claimName: mysqlvol
  containers:
    - name: task-pv-container
      image: nginx
      ports:
        - containerPort: 80
          name: &quot;http-server&quot;
      volumeMounts:
        - mountPath: &quot;/usr/share/nginx/html&quot;
          name: task-pv-storage

I am able to write data > 10GiB.

root@task-pv-pod:/usr/share/nginx/html# ls -lh
total 15G
-rw-r--r-- 1 root root 15G May 22 04:16 bigfile.txt
-rw-r--r-- 1 root root   3 May 18 12:04 new.txt
root@task-pv-pod:/usr/share/nginx/html#   
  1. What is the relevance of 10GiB here as I can write any amount of data in the volume [ 15GiB also works ]
  2. Why does PVC creation fail when request size is > 10GiB given the fact that volume is capable of accommodating higher size.

答案1

得分: 1

没有存储保留,也没有配额。
您声明卷的容量为10GiB,当创建具有该请求的PVC时,它将与声明的空间匹配。

英文:

There is no storage reservation, nor quota.
You declare that the volume is capable of 10GiB and when a PVC with that request is created, it is matched against the declared space.

huangapple
  • 本文由 发表于 2023年5月21日 17:08:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76299100.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定