Running Kubernetes on AWS Fargate

Running Kubernetes on AWS Fargate


Related discussions:

We had systems running on fargate but had to switch back to ec2 based systems. You should be cautious on what config / applications you want to run on fargate.

Why? Cost?

No. Pods shutting down out of unknown reasons. We suspected due to some configuration issue. However, our contractor, who sold us the config package, also didn’t know why so we went back to ec2 as it is more stable (+ cheaper + less reliance on aws).

Could you elaborate please?

I have multiple containers running for a lot of days in ECS without any problem.

EC2 can be a problem because it’s another piece you need to manage and to being able to scale you need to scale the full machine.

If you want to manage containers and not using ECS, the only solution you have is EKS. This is the way.

Do you know what kind of scale you were running at? Perhaps you were running into service quota limits for Fargate?

Isn’t Fargate only 10-15% more expensive than a similarly-configured EC2 instance? https://aws.amazon.com/fargate/pricing/

When Fargate announced price drops a few years ago we switched from EC2-based ECS to Fargate within a couple weeks and were happy to pay a bit extra for a much simpler architecture and autoscaling story.

Or are you talking about the price of AWS in general?

For me it was performance, I tried very hard to use Fargate but the performance was significantly worse compared to running ECS on EC2 Container Instances, to the point where it was not viable at the place I work at. There is a ticket on the AWS container roadmap for giving the option to specify a preference for the under lying host that a Fargate task runs on, but until that’s available I can’t recommend Fargate as a platform for applications where performance is important.

Is pods shutting down an issue? That sort of unreliability is what the orchestration systems are designed to deal with automatically, no?

We did use EKS with fargate :wink:

Fargate also prevents docker in docker. So if you are building images it’s a no go.

Found out the hard way when I switched our Gitlab runner over to fargate.

https://docs.aws.amazon.com/AmazonECS/latest/userguide/task-maintenance.html

AWS needs to take down Fargate tasks to perform maintenance. They will notify your service and kill it gracefully.

A task will not be shut down out of unknown reasons. A reason will always be given.

Eks with fargate? I thought Fargate is ECS to manage only containers. Are you launching kubernetes as containers?

Why? Fargate works great for many different applications, both stateful and stateless.

You should be using AWS CodeBuild or GitHub Actions, or similar, to build and push your container images to ECR, or whatever your preferred registry is. I would not recommend using AWS Fargate to build container images. That’s not what it is designed or intended for.

Edit: Also, you can apparently build container images in AWS Fargate using kaniko.

https://aws.amazon.com/blogs/containers/building-container-images-on-amazon-ecs-on-aws-fargate/

Yeah never got that to work in combination with the Gitlab.

We are using code build now for the images but I find it strange that I am limited in my use of the container runtime.

I know it for security but at least let me have the option todo so

EKS works with Fargate too

I didn’t know that. Thanks for the info.

No, the pricing varies. At the low end for small containers the pricing is as much as 3x a t3.nano. Their 10% claim seems to be for very large amounts of cpu and memory. At the smaller end it increases costs dramatically. (Yes even with the price change from a couple years ago)