Run Serverless Kubernetes Pods Using Amazon EKS and AWS Fargate
Posted On: Dec 3, 2019
You can now use Amazon Elastic Kubernetes Service (EKS) to run Kubernetes pods on AWS Fargate, the serverless compute engine built for containers on AWS. This makes it easier than ever to build and run your Kubernetes applications in the AWS cloud.
EKS support for Fargate is available in US East (Virginia), US East (Ohio), Europe (Ireland), and Asia Pacific (Tokyo) regions.
https://github.com/aws/containers-roadmap/issues/32#issuecomment-561249391
How does this look from a Terraform perspective? What new resources?
Yeah, I dont know quite much at this moment either.
Provider 2.41.0 added aws_eks_fargate_profile.
These need a suitable IAM role to be created: docs
We could also handle a map of profile name to namespace and labels, and create the profiles in a for_each.
There is currently a limitation. Not every region support it.
If you want to explore Amazon EKS on AWS Fargate yourself, you can try it now by heading on over to the EKS console in the following regions: US East (N. Virginia), US East (Ohio), Europe (Ireland), and Asia Pacific (Tokyo). (reference)
AWS tracks the roll-out progress in their public roadmap: https://github.com/aws/containers-roadmap/issues/620
I'd just like to toss in a +1 for this feature request.
Been banging my head against adding Fargate to EKS via Terraform for the last day or so, modding other Terraform modules (terraform-module/eks-fargate-profile/aws) to accept list(string) instead of just string for Namespaces and then working the compatibility of that, resulting in a mild migraine.
Edit:
aws/containers-roadmap#621 is tracking wildcard support for Fargate Namespaces
Edit 2:
It looks like you can only create Fargate profiles so long as no other profile is in a CREATING status.
The module will either need to create a single Fargate profile which watches multiple Namespaces by using the aws_cloudformation_stack resource (because the aws_eks_fargate_profile resource only supports a single Namespace string argument) or it will need to wait for each previous Fargate profile status to be ACTIVE before creating the next profile.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I'm really interested in seeing fargate profiles added as well.
This would be extremly useful.
Adding Fargate on a deployment only requires few lines of code, it's very quick, this is mine:
module "eks_fargate" {
source = "terraform-module/eks-fargate-profile/aws"
version = "2.2.5"
cluster_name = data.terraform_remote_state.eks_cluster.outputs.cluster_id
subnet_ids = data.aws_subnet_ids.private.ids
namespaces = [
"jenkins"
]
labels = {
"app.kubernetes.io/name" = "jenkins-fargate-slaves"
}
tags = local.project_tags
}
I totally understand that argument where people would like to keep the module simple, otherwise they become a mess.
The PR #1067 add fargate support. We need reviewers and help for tests.
v13.2.0 is released with the EKS fargate support.
Most helpful comment
I'd just like to toss in a +1 for this feature request.
Been banging my head against adding Fargate to EKS via Terraform for the last day or so, modding other Terraform modules (
terraform-module/eks-fargate-profile/aws) to acceptlist(string)instead of juststringfor Namespaces and then working the compatibility of that, resulting in a mild migraine.Edit:
aws/containers-roadmap#621 is tracking wildcard support for Fargate Namespaces
Edit 2:
It looks like you can only create Fargate profiles so long as no other profile is in a
CREATINGstatus.The module will either need to create a single Fargate profile which watches multiple Namespaces by using the
aws_cloudformation_stackresource (because theaws_eks_fargate_profileresource only supports a single Namespacestringargument) or it will need to wait for each previous Fargate profile status to beACTIVEbefore creating the next profile.