memory request 先開一個荒謬的數字
resources:
requests:
memory: "100Gi"
cpu: "50m"
limits:
cpu: "200m"
memory: "100Gi"
requests 不能大於 limits,limits 要一起放大,不然 apply 會被擋,另外不需要真的去消耗那麼多記憶體,光是預約就足以讓它排不進去
kubectl apply -f manifests/base
kubectl get pods -n ithome-lab

Pending,這個狀態的意思是這個 Pod 還沒有被指派到任何一台 Node
Pending 的 Pod 沒有 Container,所以有些指令會直接失效
kubectl logs <POD_NAME> -n ithome-lab
會發現沒東西出現,因為程式還沒有被放到機器上,所以沒有輸出
所以遇到 Pending,logs 這一步可以直接跳過
describe
kubectl describe pod <POD_NAME> -n ithome-lab

Insufficient memory 就是記憶體不夠
順便看一下 Node
kubectl describe node


排程器比對的是 Allocatable 跟已經預約掉的量,不是實際使用量
Insufficient memory 只是 Pending 的其中一種原因,Events 那行訊息還可能是別的
沒有符合 nodeSelector 或 affinity 條件的機器,訊息會是 didn't match node selector;Node 上有 taint 而 Pod 沒有對應的 toleration,訊息會提到 taint;如果是要掛儲存,PVC 還沒 bound 也會卡在 Pending。這幾種的 STATUS 都是 Pending,一樣要靠 Events 那一行分辨
修復就是把數字改回去
kubectl apply -f manifests/base
kubectl get pods -n ithome-lab
明天見 :D
