我覺得我誤解emptyDir了 Kubernetes 中基于 RAM 的卷。
假設我的 Kubernetes 節點總共有 100GB。如果我有 4 個不同的 emptyDirs
emptyDir.medium設定為“記憶體”,默認情況下它們都有 50GB 的記憶體嗎?在那種情況下,當我的 4 個 emptyDirs 中使用的記憶體總量超過 100GB 時會發生什么?我知道一般 RAM 很快,但有哪些缺點示例?從官方檔案中,我看到了以下內容,但我不太明白該宣告。我的理解是,如果 Pod 崩潰,使用磁盤的 emptyDirs 上的檔案仍然會被洗掉。如果檔案存盤在磁盤中,是否會在節點重新啟動時保留這些檔案?還有它們是什么意思
count against container memory limit?
While tmpfs is very fast, be aware that unlike disks,
tmpfs is cleared on node reboot and any files you
write count against your container's memory limit
uj5u.com熱心網友回復:
...by default will they all have 50GBs of memory?
是的。您可以執行到 pod 并使用df -h. 如果您的集群啟用了SizeMemoryBackedVolumes功能,您可以指定大小。
...what happens when the total amount of memory used in my 4 emptyDirs exceeds 100GB?
你不會有這個機會,因為當所有 emptyDir(s) 使用的記憶體總量達到 50GB 時;您的 pod 將被驅逐。它不需要一個 emptyDir 來達到 50GB 來驅逐。
...don't quite understand the statement.
這意味著您將無法取回存盤在 emptyDir 上的資料。
count against container memory limit
這意味著您使用 emptyDir 消耗的記憶體量被添加到您的容器使用的記憶體量并檢查 resources.limits.memory。
uj5u.com熱心網友回復:
相同的檔案頁面:
當 Pod 因任何原因從節點中移除時,emptyDir 中的資料將被永久洗掉。
注意:容器崩潰不會從節點中洗掉 Pod。emptyDir 卷中的資料在容器崩潰時是安全的。
所以 pod crash 不會導致emptyDirvolume 被清除。
關于記憶體支持卷的一般使用:始終指定 pod 記憶體限制,否則您可能會面臨各種反直覺的 pod 驅逐等意外。
此外,如果您打算主動寫入記憶體支持的卷(這就是記憶體的用途),您需要仔細控制寫入的資料量,否則您可能會遇到奇怪的應用程式崩潰。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/410385.html
標籤:
