By using AWS re:Post, you agree to the AWS re:Post Terms of Use

About get CPU and Memory Utilization in EKS Fargate

0

I have read about EKS can be scaled up with Horizontal Pod Autoscaler (HPA) in AWS Documents but I kinda of stuck where we get can't the precentage of CPU utilization (same for memory) for each Pod in EKS Cluster deployed Fargate.

I have tried to use metric-server adds-on but not working Another way is I see someone told to use Container Insights Adds-on (a service from AWS Cloudwatch) to get those metric.

So does container insights is the possible solution for what I need for HPA in EKS Fargate Cluster. If not, are there any ways to scale up in EKS Fargate

2 Answers
0

For EKS clusters using Fargate, obtaining CPU and memory utilization metrics for individual pods can indeed be challenging, as the traditional metric-server add-on doesn't work in the same way it does for EC2-based EKS clusters. However, there are solutions available to address this issue and enable Horizontal Pod Autoscaler (HPA) functionality in EKS Fargate.

Container Insights, which is a feature of AWS CloudWatch, is indeed a viable solution for obtaining the necessary metrics for HPA in EKS Fargate clusters. It provides detailed performance metrics at the cluster, node, pod, and container levels, including CPU and memory utilization. By enabling Container Insights, you can collect and analyze these metrics, which can then be used to inform your HPA decisions.

To implement HPA in EKS Fargate using Container Insights, you would typically follow these steps:

  1. Enable Container Insights for your EKS Fargate cluster.
  2. Configure CloudWatch to collect the relevant metrics.
  3. Set up your HPA to use these CloudWatch metrics for scaling decisions.

It's important to note that while Container Insights is a powerful tool, it may introduce additional costs due to the increased CloudWatch usage.

Another approach to consider is using the AWS Distro for OpenTelemetry (ADOT) collector for application monitoring. This can be set up to collect and export metrics from your Fargate pods, which can then be used for HPA.

For scaling in EKS Fargate, you have a few options:

  1. Use HPA with Container Insights or ADOT as mentioned above.
  2. Implement the Vertical Pod Autoscaler (VPA) to automatically adjust the CPU and memory requirements of your pods. When using VPA with Fargate, it's recommended to set the mode to either "Auto" or "Recreate" to ensure proper functionality.
  3. Manually adjust the Fargate profile to include different pod sizes based on your application's needs.

Remember that Fargate provides pod isolation by scheduling one pod per node, and it can scale workloads from as small as 0.25 vCPU with 0.5 GB memory to as large as 16 vCPU with 120 GB memory. However, there are limitations on the available pod size variations, so you'll need to carefully consider how your workload fits into the available Fargate configurations.

In summary, while the traditional metric-server approach may not work for EKS Fargate, solutions like Container Insights or ADOT can provide the necessary metrics for implementing HPA. Additionally, considering VPA or manual Fargate profile adjustments can help you effectively manage scaling in your EKS Fargate cluster.
Sources
Scale pod deployments with Horizontal Pod Autoscaler - Amazon EKS
Compute and Autoscaling - Amazon EKS
Get started with AWS Fargate for your cluster - Amazon EKS

profile picture
answered a month ago
0

1. Monitor Fargate Pods with Prometheus

Set up Prometheus to scrape metrics from your Fargate pods by following the AWS guide on monitoring Amazon EKS on Fargate with Prometheus and Grafana. This setup enables you to collect custom metrics, such as request rate, CPU usage, and memory utilization.

2. Configure HPA with Custom Metrics

To use these custom metrics with the Horizontal Pod Autoscaler (HPA), install the Prometheus Adapter. This adapter exposes metrics collected by Prometheus to the Kubernetes API, making them available for HPA to use in scaling decisions. you can configure the same using following blog post https://aws.amazon.com/blogs/containers/autoscaling-eks-on-fargate-with-custom-metrics/

3. Configure KEDA for Event-Driven Autoscaling (ALTERNATE METHOD)

Alternatively, use KEDA (Kubernetes Event-Driven Autoscaling) to scale based on Prometheus metrics. KEDA supports autoscaling triggered by multiple event sources, including Prometheus metrics. :

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions