目前,我看到了一个奇怪的问题,我有一个Pod,它一直是库伯内特斯的Evicted。
我的集群/应用程序信息:
2vCPU
7.5GB RAM /7.5GB RAM语言:nodejsAzure Kubernetes Service (AKS)上每hour)
我尝试了什么:
kubectl get events:8m17s Normal NodeHasSufficientMemory node/node-1 Node node-1 status is now: NodeHasSufficientMemory
2m28s Warning EvictionThresholdMet node/node-1 Attempting to reclaim memory
71m Warning FailedScheduling pod/my-deployment 0/4 nodes are available: 1 node(s) had taint {node.kubernetes.io/memory-pressure: }, that the pod didn't tolerate, 3 node(s) didn't match node selectorkubectl top pods,显示它只使用了节点内存的30%的内存,kubectl top pods中增加了资源限制apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-d
spec:
replicas: 1
template:
spec:
containers:
- name: main
image: my-image
imagePullPolicy: Always
resources:
limits:
memory: "2Gi"当前的思维方式:
节点具有X内存总可用,但是从X内存中只有Y实际上是可分配的,因为保留了空间。然而,当在os.totalmem()中运行node.js时,我仍然能够看到Node被允许分配X内存。
我在这里想的是,Node.js之所以分配到X,是因为它的垃圾收集应该从Y开始,而不是X。然而,由于我的限制,我实际上期望它看到的是极限,而不是K8S节点的内存限制。
问题
还有什么事情我应该试着解决吗?以前有人有过这个吗?
发布于 2021-01-24 13:40:26
您不知道NodeJS应用程序在容器中运行。它只看到Linux内核报告的内存量(它总是报告节点内存总量)。您应该让应用程序意识到cgroup的限制,请参阅https://medium.com/the-node-js-collection/node-js-memory-management-in-container-environments-7eb8409a74e8。
关于驱逐:当你设置了记忆限制--这解决了你的驱逐问题吗?
也不要太信任kubectl top pods。它总是以延迟的方式显示数据。
https://stackoverflow.com/questions/65852051
复制相似问题