1

I'm using AWS EKS with fargate, in my deployment, I set the resources.requests.memory to 512 Mi, but the fargate node will still request 1Gi. So I looking the prometheus kube states for that pod, it show that pod request 762 Mi. Because 762-512=250, so I was checked other deployments, found that it always request memory more than I defined about 200 Mi. Is this a k8s issue, or just a fargate rule?

resources:
limits:
  memory: 512Mi
  cpu: "0.25"
requests:
  memory: 512Mi
  cpu: "0.25"
Annotations:          CapacityProvisioned: 0.25vCPU 1GB
Memory Request: 762 Mi

After update requests to 250 Mi:

resources:
limits:
  memory: 500Mi
  cpu: "0.25"
requests:
  memory: 250Mi
  cpu: "0.25"
Annotations:          CapacityProvisioned: 0.25vCPU 0.5GB
johnson
  • 388
  • 5
  • 16

2 Answers2

2

I found the explaination in Monitoring Amazon EKS on AWS Fargate using Prometheus and Grafana

The current version of the dashboard doesn’t consider initContainers’ requests. This is because kube-state-metrics doesn’t expose resources requested by initContainers.

The requests metric in the graph will be absent if none of the long-running containers request any resources. The request metric should not be confused with the total CPU and memory the pod has at its disposal. The pod’s CPU and memory is determined by the calculated Fargate configuration of the pod, as explained above.

sum(kube_pod_container_resource_requests{resource="memory"}+262144000)

If I request 512 Mi, the fargate node will request another 250 Mi for the init container, my final memory request will be 762 Mi. So if I want to keep the fargate capacity provisioned is 0.5GB, my request memory should not be greater than 262 Mi.

I don't think this is reasonable.

johnson
  • 388
  • 5
  • 16
0

The additional 256m is used for kubelet and other daemon processes rather than your init container.

Fargate adds 256 MB to each pod’s memory reservation for the required Kubernetes components (kubelet, kube-proxy, and containerd).
GongYi
  • 1
  • 1