Moving Amazon EKS pods from Fargate to EC2 managed node groups
We moved application pods, CoreDNS, and two controllers from Fargate to an EC2 managed node group in the same Amazon EKS cluster.
Guide details
- Platform
- Amazon EKS
- Scope
- Fargate profile selectors, the compute-type annotation, and managed node group deletion
- Last technically verified
- October 18, 2026
- Evidence basis
- Production work and documentation
We moved application pods, CoreDNS, and two controllers from Fargate to an EC2 managed node group in the same Amazon EKS cluster. The API server, Services, and Application Load Balancer stayed in place. The ALB kept its address; the replacement pods received new IPs.
The EC2 capacity was already joined to the cluster. We tested the move on a two-replica Deployment, then added eks.amazonaws.com/compute-type: ec2 to the application pod templates and rolled them one at a time. After moving CoreDNS and the controllers, we started deleting the Fargate profile. Consolidating workloads onto the newer of two EC2 node groups was a separate step.
The recorded checks confirm pod placement and successful manual drains. They do not confirm that either deletion finished, and we did not collect a before-and-after bill. The verification table at the end separates those results.
Why we moved these workloads
We needed DaemonSets alongside the application pods and more control over node placement. Fargate does not support DaemonSets or privileged containers. The VPC CNI, kube-proxy, EBS CSI node plugin, and Pod Identity agent were already running on the cluster’s EC2 nodes. See the EKS Fargate considerations.
The applications ran steadily, so we also wanted to evaluate packing several pods onto instances instead of paying for separate Fargate compute environments. That changes the cost model, but it does not establish a saving. EC2 cost depends on instance size, utilization, and spare capacity. Fargate may still suit workloads that run intermittently and do not need node-level agents.
With EC2, we also take responsibility for scheduling node updates, maintaining spare capacity, and replacing instances. EKS manages the node group lifecycle, but we still have to plan those operations around the workloads.
| Area | Fargate in this cluster | EC2 managed node groups |
|---|---|---|
| Pod compute | A separate compute environment for each pod | Several pods can share an instance |
| Worker maintenance | AWS maintains the Fargate environment | We plan node updates and replacement capacity |
| DaemonSets | Unsupported | Already running on EC2 nodes |
| Placement | Profile selectors matched namespaces, including kube-system | Compute-type annotation for EC2; node selector where a specific group was required |
| Load balancing | ALB with IP targets | Same ALB and target mode, with replacement pod IPs |
| Available capacity | Fargate creates compute for matching pods | The managed node group was already joined |
For allocating the cost of shared nodes to workloads, see Kubernetes cost allocation.

Inspect the profile and EC2 capacity
The commands use placeholders to protect customer details. Replace the quoted values before running them, and replace placeholders in later examples with your own resource names. The application examples use default; use the namespace selected by your profile.
export CLUSTER='<cluster-name>'
export REGION='<aws-region>'
export PROFILE='<profile-name>'
export NEW_NODEGROUP='<new-nodegroup>'
export OLD_NODEGROUP='<old-nodegroup>'
Start by listing the profiles and describing the one you plan to remove:
aws eks list-fargate-profiles \
--cluster-name "$CLUSTER" \
--region "$REGION"
aws eks describe-fargate-profile \
--cluster-name "$CLUSTER" \
--fargate-profile-name "$PROFILE" \
--region "$REGION"
Our profile selected default and kube-system without label filters:
{
"selectors": [
{
"namespace": "default"
},
{
"namespace": "kube-system"
}
]
}
A namespace selector without labels makes every pod in that namespace eligible for the profile. Profiles select pods, not Deployment names, and their selectors cannot be edited in place. Read the live profile rather than assuming it matches this example. AWS documents these rules under Fargate profiles.
Next, check where the pods actually run:
kubectl get pods -A -o wide
kubectl get pods -A -o wide | grep 'fargate-ip'
On this cluster, Fargate node names began with fargate-ip-, while EC2 node names began with ip-. We read the NODE column. An application name containing fargate says nothing about its current placement.
List the managed node groups and inspect their nodes:
aws eks list-nodegroups \
--cluster-name "$CLUSTER" \
--region "$REGION"
kubectl get nodes -o wide
kubectl get nodes \
-o custom-columns='NODE:.metadata.name,NODEGROUP:.metadata.labels.eks\.amazonaws\.com/nodegroup,CREATED:.metadata.creationTimestamp'
kubectl top nodes
kubectl describe nodes
We used the eks.amazonaws.com/nodegroup label, creation timestamps, and instance types to distinguish the older group from the replacement. The original notes do not record instance sizes or node counts.
kubectl top requires metrics-server, which was installed here. Use describe nodes to compare allocated requests with allocatable CPU and memory, inspect taints, and check pod capacity. A node can be Ready and still have no room for a replacement pod. Leave capacity for the extra pod created during a rolling update.

Test placement before moving applications
We first created a two-replica test Deployment with a readiness probe. Its pod template included:
metadata:
annotations:
eks.amazonaws.com/compute-type: ec2
AWS documents this annotation in the CoreDNS setup for Fargate. We applied it to the test Deployment and observed its replacement pods on EC2. That test established the behavior in this cluster; it does not replace checking placement in another environment.
For an existing Deployment, merge the annotation into spec.template.metadata:
kubectl patch deployment <deployment-name> \
--namespace default \
--type merge \
-p '{
"spec": {
"template": {
"metadata": {
"annotations": {
"eks.amazonaws.com/compute-type": "ec2"
}
}
}
}
}'
kubectl rollout status deployment/<deployment-name> \
--namespace default \
--timeout=10m
kubectl get pods --namespace default -o wide
Changing the pod template starts a rollout. Wait for it to finish, then check the NODE column. The annotation does not choose a particular managed node group: with two suitable groups, either can receive the pod.
Draining a Fargate node would only evict its current pod. If the replacement still matches the profile and remains eligible for Fargate, it can return on another Fargate node. Change the Deployment’s scheduling configuration first.
For applications that must keep serving, configure the Deployment to retain its existing available replicas while starting a replacement:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
These values allow one extra pod and prevent the rollout from deliberately reducing the available replica count. If the new pod never becomes ready, the rollout should stall with the old replicas retained. This setting alone cannot guarantee uninterrupted traffic: readiness checks, ALB target registration, and application shutdown behavior must also work correctly.
Roll the application Deployments
After the test succeeded, we moved the applications one Deployment at a time. Replace the example names before running this loop:
for deployment in \
'<deployment-one>' \
'<deployment-two>' \
'<deployment-three>'
do
echo "Migrating $deployment"
kubectl patch deployment "$deployment" \
--namespace default \
--type merge \
-p '{
"spec": {
"template": {
"metadata": {
"annotations": {
"eks.amazonaws.com/compute-type": "ec2"
}
}
}
}
}' || break
kubectl rollout status "deployment/$deployment" \
--namespace default \
--timeout=10m || break
done
The loop stops if a patch fails or a rollout does not finish. Investigate that Deployment before continuing.
Check the replacement pods and their IPs:
kubectl get pods --namespace default \
-o custom-columns='POD:.metadata.name,NODE:.spec.nodeName,IP:.status.podIP'
Fargate gives each pod a network interface in the profile’s subnets. On these EC2 nodes, the VPC CNI assigned pod addresses. Our replacement pods received different IPs, which then had to appear in the Service’s backend information and the ALB target group.
Verify Service endpoints and ALB targets
Compare EndpointSlices before and after the move:
kubectl get endpointslice --namespace default -o wide
kubectl get endpointslice --namespace default -o yaml
After the rollouts, we saw the EC2 pod IPs in the application slices. Inspect endpoint conditions as well as addresses. An unready pod can still appear in an EndpointSlice with ready: false; its presence alone does not establish that it should receive traffic. Services with publishNotReadyAddresses: true need separate attention. See the Kubernetes EndpointSlice conditions.
The existing internet-facing ALB was managed by the AWS Load Balancer Controller. Its Ingress used:
alb.ingress.kubernetes.io/target-type: ip
In this mode, the controller registers pod IPs in the target group. The configuration already supported Fargate and also worked for the replacement EC2 pods, so we left the Ingress unchanged. The controller’s target-type documentation describes the two target modes.
Compare the Ingress address before the first application rollout and after the last:
kubectl get ingress <ingress-name> --namespace default
The address stayed the same in our checks. We also checked target health in AWS and looked for reconciliation errors:
kubectl logs \
--namespace kube-system \
deployment/aws-load-balancer-controller \
--since=15m
An unchanged ALB address does not prove the new targets are healthy. Target registration and deregistration also take time, so test application requests through the load balancer during the rollout.
The load balancer controller was still on Fargate at this stage. Check its workload IAM configuration before moving it. Existing listeners can continue serving while insufficient controller permissions prevent later target-group changes.
Move CoreDNS and the controllers
The profile selected kube-system, so CoreDNS, the AWS Load Balancer Controller, and the EBS CSI controller were also on Fargate. We added the same compute-type annotation to each Deployment in kube-system and waited for each rollout before deleting the profile.
Use the earlier Deployment patch with the correct name and namespace. Then check placement and rollout status:
kubectl get pods \
--namespace kube-system \
-l k8s-app=kube-dns \
-o wide
kubectl get pods \
--namespace kube-system \
-l app=ebs-csi-controller \
-o wide
kubectl rollout status \
deployment/aws-load-balancer-controller \
--namespace kube-system \
--timeout=10m
kubectl get pods -A -o wide
k8s-app=kube-dns selected CoreDNS, and app=ebs-csi-controller selected the EBS CSI controller in this cluster. If either query returns no pods, inspect the Deployment’s actual selector. The final listing showed all three components on EC2.
The VPC CNI, kube-proxy, EBS CSI node plugin, and Pod Identity agent were already DaemonSets on EC2, so they did not need this migration.
Persist scheduling changes in the configuration that owns each Deployment. A live patch can be overwritten by Helm, an add-on update, or another reconciler. Check which settings the installed add-on version supports rather than assuming an arbitrary annotation can be supplied through its configuration schema. AWS describes CoreDNS update considerations in Manage CoreDNS.
Delete the Fargate profile after checking placement
We checked again for pods on the Fargate node prefix:
kubectl get pods -A -o wide | grep 'fargate-ip' || true
This is a quick filter for the node naming used here. Read the full pod listing too; the filter is not proof that every workload is healthy or that every profile is unused.
Deleting the profile stops pods still running through it. We issued the command only after the required applications and system components had moved:
aws eks delete-fargate-profile \
--cluster-name "$CLUSTER" \
--fargate-profile-name "$PROFILE" \
--region "$REGION"
aws eks list-fargate-profiles \
--cluster-name "$CLUSTER" \
--region "$REGION"
Deletion is asynchronous. Repeat the listing until $PROFILE is absent. Our record ends before a listing confirms its removal.
Pods stopped by deletion may be placed through another matching profile. Without one, Fargate cannot run them; replacement pods need compatible EC2 scheduling configuration and capacity or may remain pending. AWS also requires a profile in DELETING to finish before another profile can be created. See the profile lifecycle rules.
Rollback while the profile still exists
Before deletion starts, a Deployment can return to Fargate by removing the compute-type annotation from its pod template and rolling it again. This requires a matching profile and a Fargate-compatible template. If you have added an EC2 node selector, affinity, or other EC2-specific configuration, remove that constraint too.
Once the profile has been deleted, returning to Fargate requires another matching profile. Keep that boundary in mind before issuing the delete command.
Consolidate workloads onto the newer EC2 group
Moving off Fargate left pods spread across two managed node groups. For Deployments that needed to leave the older group, we added this pod selector:
spec:
template:
spec:
nodeSelector:
eks.amazonaws.com/nodegroup: <new-nodegroup>
Apply it to each relevant Deployment and wait for the rollout:
kubectl patch deployment <deployment-name> \
--namespace default \
--type merge \
-p '{
"spec": {
"template": {
"spec": {
"nodeSelector": {
"eks.amazonaws.com/nodegroup": "<new-nodegroup>"
}
}
}
}
}'
kubectl rollout status deployment/<deployment-name> \
--namespace default \
--timeout=10m
kubectl get pods --namespace default -o wide
kubectl get nodes \
-o custom-columns='NODE:.metadata.name,NODEGROUP:.metadata.labels.eks\.amazonaws\.com/nodegroup'
The patch starts another rollout. Compare each pod’s node with the node-group label; a healthy pod can still be on the group you intend to remove.
Keep the selector in the Helm chart or other source configuration as well. A later release can overwrite a live patch. We used the EKS node-group label because we needed one specific group, but that value must change when the group is replaced. A stable label you manage can avoid tying workload configuration to a group name.
If only one suitable EC2 group exists and no matching Fargate profile remains, this extra selector may be unnecessary.
Cordon and drain the older nodes
We identified each old node by its $OLD_NODEGROUP label and cordoned it:
kubectl cordon <old-node-name>
Cordon prevents new ordinary pods from being scheduled there; it does not move existing pods. We confirmed Ready,SchedulingDisabled before proceeding.
The Datadog cluster agent, Datadog operator, and metrics-server still had pods on the older nodes. We located their Deployments with kubectl get deploy -A, applied the same node selector in their respective namespaces, and checked each rollout and destination node. The Datadog node agent was a DaemonSet and remained until its node was removed.
After moving the ordinary workloads, we drained one old node at a time to catch any remaining evictable pods:
kubectl drain <old-node-name> \
--ignore-daemonsets \
--grace-period=60 \
--timeout=15m
--ignore-daemonsets allows the drain to proceed without evicting DaemonSet pods. The command allows 60 seconds for each evicted pod’s graceful termination and waits up to 15 minutes overall. A PodDisruptionBudget can block an eviction. Our manual drains finished within that window.
If a pod uses emptyDir, drain refuses to proceed without --delete-emptydir-data. Adding that flag permits eviction and loss of the local data. Inspect the pod before allowing it. We did not need the flag here.
Start deletion and confirm it separately
With ordinary pods off the older nodes, we started deleting the group:
aws eks delete-nodegroup \
--cluster-name "$CLUSTER" \
--nodegroup-name "$OLD_NODEGROUP" \
--region "$REGION"
aws eks list-nodegroups \
--cluster-name "$CLUSTER" \
--region "$REGION"
EKS reduces the Auto Scaling group’s minimum, maximum, and desired capacity to zero and attempts to drain nodes before termination. If a drain is still incomplete after five minutes, Auto Scaling can terminate the instance anyway. Manually draining first lets you resolve blocked evictions before that deadline. These are the documented managed node group deletion behaviors.
Also check whether self-managed nodes share the group’s IAM role. If deletion removes the role’s aws-auth mapping because no other managed group uses it, those self-managed nodes can become NotReady. Preserve the access they require before deleting the group.
The old nodes were cordoned and manually drained, and group deletion was started. We do not have a later listing confirming that $OLD_NODEGROUP disappeared. Repeat the listing before treating the group as retired.
What the verification established
Use the cluster listings to check placement, replica availability, endpoints, and ingress:
kubectl get nodes -o wide
kubectl get pods -A -o wide
kubectl get deployments -A
kubectl get endpointslice -A
kubectl get ingress -A
Also call an application health URL from outside the cluster, resolve a Service name from a debug pod, and inspect the metrics you normally alert on. Those are additional validation steps; the recorded results below do not establish that every one was performed. Kubernetes readiness alone does not establish end-to-end application health.
| Check | Recorded result |
|---|---|
| Application pods | On EC2 nodes after the rollouts, with new pod IPs |
| EndpointSlices | EC2 pod IPs present after readiness passed |
| Ingress address | Unchanged; target health was checked in AWS |
| CoreDNS, AWS Load Balancer Controller, and EBS CSI controller | On EC2 after the system Deployment rollouts |
| Older EC2 nodes | Cordoned; ordinary pods drained; manual drains completed within 15 minutes |
| Fargate profile | Delete command issued after required pods moved; final removal not confirmed |
| Old managed node group | Deletion started; final removal not confirmed |
| Cost | No before-and-after billing measurement |
If spending changes after the migration, use the Kubernetes cluster cost increase runbook to investigate the bill. Pod placement and a stable ALB address establish part of the migration result; they do not establish cost savings or completed infrastructure removal.
Official sources
Documentation verified October 18, 2026