Skip to main content
AWS Fargate is a serverless compute engine for containers. When combined with EKS, it lets you run Kubernetes pods without provisioning or managing EC2 instances. Each pod runs in its own isolated micro-VM, billed per pod rather than per node. Fargate profiles tell EKS which pods should run on Fargate by matching on namespace and optional label selectors. Any pod that matches a profile is automatically scheduled on Fargate.

Prerequisites

  • AWS credentials with permissions to create EKS, IAM, and VPC resources
  • Terraform >= 1.5.7
  • AWS provider >= 6.28
  • A VPC with private subnets (Fargate pods run in private subnets only)
Fargate does not support DaemonSet workloads. If your cluster requires DaemonSets (e.g. for log shipping or monitoring agents), you will need at least one EC2 node group alongside your Fargate profiles, or use alternatives such as sidecar injection.

Example code

The fargate_profiles map is defined inline on the module "eks" block. The following example creates a cluster with Fargate profiles for the default and kube-system namespaces, which is a common pattern for fully serverless clusters.

Complete VPC setup

For a self-contained deployment that also provisions the VPC:

Key concepts

Fargate profile selectors

Each entry in the selectors list can specify:
  • namespace (required) — pods in this namespace are eligible for Fargate
  • labels (optional) — additional label filters; all specified labels must match

IAM roles for Fargate

The module creates a dedicated IAM execution role for each Fargate profile by default. You can share a single role across profiles by providing an iam_role_arn and setting create_iam_role = false.

CoreDNS on Fargate

When running a fully Fargate cluster (no EC2 nodes), CoreDNS must also run on Fargate. This requires patching the CoreDNS deployment to remove the eks.amazonaws.com/compute-type: ec2 annotation:
Alternatively, set resolve_conflicts_on_create = "OVERWRITE" on the coredns addon to have EKS automatically configure it for Fargate.

Deploy

1

Initialize Terraform

2

Review the plan

3

Apply

4

Configure kubectl

5

Verify Fargate nodes

Pods scheduled on Fargate appear as nodes with the fargate- prefix.

Key outputs

Limitations

  • No DaemonSets — Fargate does not support DaemonSet workloads
  • No privileged containers — pods running on Fargate cannot use privileged: true
  • No hostPath volumes — only emptyDir, configMap, secret, and persistent volume claims via EFS are supported
  • No GPU — Fargate does not support GPU instance types
  • Regional availability — not all AWS regions or Availability Zones support Fargate

Further reading