EKS : Cluster destroy failing for Fargate w/ CoreDNS addon #28621
Labels
@aws-cdk/aws-eks
Related to Amazon Elastic Kubernetes Service
bug
This issue is a bug.
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
effort/medium
Medium work item – several days of effort
p2
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Describe the bug
When using the CoreDNS addon for a Fargate Cluster, the teardown fails and the resources created are not deleted. The error is caused by CoreDNSComputeType patch which is automatically applied to Fargate clusters.
Expected Behavior
The cluster created by
cdk deploy
should delete and clean up all resources usingcdk destroy
Current Behavior
Delete fails and some of the resources are kept intact
This shows up in the terminal running destroy
Reproduction Steps
In the terminal run
cdk init sample-app --language=typescript
Replace lib/cdk-stack.ts with the code below
run
cdk deploy
wait for deployment to complete
run
cdk destroy
Possible Solution
Reason for bug:
The k8s-patch for computeType annotations are applied with no dependency on the coreDNS addon themselves.
When we run the
cdk destroy
command, first the addons are removed. This means that the coredns deployment is deleted first and then the kubectl patch is attempted to be removed. This results in the console outputReceived response status [FAILED] from custom resource. Message returned: Error: b'Error from server (NotFound): deployments.apps "coredns" not found\n'
Possible Fix
Set removal policy for either the CoreDNSComputeType Patch or the coreDNS addon to
RemovalPolicy.Retain
Additional Information/Context
No response
CDK CLI Version
2.100.0(build e1b5c77)
Framework Version
No response
Node.js Version
20.5.0
OS
Mac Sonoma
Language
TypeScript
Language Version
No response
Other information
Related Issue: #14968 - it states that CDK should be using core addons as opposed to relying on some default configuration from EKS.
The text was updated successfully, but these errors were encountered: