Skip to content

fix(aws): clean up Classic ELB and its Security Group on EKS cluster delete - #1796

Merged
cb-spider merged 1 commit into
cloud-barista:masterfrom
MZC-CSC:upstream-fix/aws-pmks-lb-cleanup-1208
Aug 10, 2026
Merged

cb-spider merged 1 commit into
cloud-barista:masterfrom
MZC-CSC:upstream-fix/aws-pmks-lb-cleanup-1208

Conversation

@dogfootman

Copy link
Copy Markdown
Contributor

Summary

Fixes #1208 — the Classic ELB (and its associated Security Group) provisioned for a PMKS/EKS cluster's control plane was left behind after cluster deletion, causing orphaned AWS resources.

Test plan

  • Verified against a live AWS PMKS cluster: create cluster → delete cluster → confirm the Classic ELB and its Security Group are removed

…delete

DeleteCluster() only called eks.DeleteCluster and returned, so any
Classic ELB (and its dedicated k8s-elb-* Security Group) that the
Kubernetes in-tree AWS cloud provider auto-created for a
type=LoadBalancer Service was left behind. This kept the cluster's
subnets in-use, blocking subsequent Subnet/VPC deletion.

DeleteCluster() now looks up the cluster's VPC before deleting, then
after a successful delete finds any Load Balancer tagged
kubernetes.io/cluster/<name>=owned in that VPC and removes it along
with its Security Group. Best-effort: failures are logged but never
turn an already-successful cluster deletion into an error, and
unrelated Load Balancers/Security Groups in the same VPC are left
untouched.

Verified against a real EKS 1.31 cluster in ap-northeast-2: a
Service(LoadBalancer)-created Classic ELB and its Security Group are
removed on cluster delete, an unrelated ELB in the same VPC survives,
and clusters with no Load Balancer or nonexistent clusters delete the
same as before.

Fixes cloud-barista#1208
@powerkimhub
powerkimhub requested a review from cb-spider August 10, 2026 04:55
@cb-spider
cb-spider merged commit df3f952 into cloud-barista:master Aug 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AWS:PMKS] Load balancer Remains after Cluster Deletion

2 participants