Skip to content

fix(scripts/eks-lifecycle): sweep orphan ALB controller LB/SG before vpc destroy - #799

Merged
panicboat merged 1 commit into
mainfrom
fix/eks-lifecycle-orphan-fallback-20260817
Aug 17, 2026
Merged

fix(scripts/eks-lifecycle): sweep orphan ALB controller LB/SG before vpc destroy#799
panicboat merged 1 commit into
mainfrom
fix/eks-lifecycle-orphan-fallback-20260817

Conversation

@panicboat

Copy link
Copy Markdown
Owner

Summary

  • eks-production の live teardown 中に発見した scripts/eks-lifecycle のギャップを修正
  • shared IngressGroup を kubectl delete ingress --all で1件ずつ削除する際、AWS Load Balancer Controller が Step 10.4 の一度きりの tag sweep 後に同名 ALB(+ 自動作成 security group)を再作成するレースがあり、eks/alb/vpc stack destroy 後にも orphan として残っていた
  • orphan ALB の ENI が VPC の IGW detach / subnet 削除をブロックし、terragrunt destroy (vpc stack) が DependencyViolation で fail する実害を確認
  • 30-destroy-stacks.sh に、eks stack destroy 直後(controller が確実に消滅した安全なタイミング)に elbv2.k8s.aws/cluster タグで ALB/NLB + security group を再 sweep する処理を追加
  • 併せて README 内の stale な karpenter stack 名(PR chore(aws): remove unused _modules, rename karpenter to eks-karpenter #798eks-karpenter rename 後に取り残されていた)を修正

Context

本日の live teardown で以下の順に手動対処した内容を、恒久対応としてスクリプトに反映:

  1. terragrunt init -upgrade(8 stack、Module version drift)
  2. SIGTERM 中断からの force-unlock 再開
  3. orphan ALB (k8s-application-92fded7941) + 2 security group の手動削除(本PRの対象)
  4. orphan target group 7個の手動削除(既存の 40-orphan-verify.sh Step 40.3 が正しく検出、対応不要と判断)

Test plan

  • shellcheck -x lib/30-destroy-stacks.sh エラーなし
  • 次回 teardown 実行時に sweep が正常動作することを確認(現在 eks-production は destroy 済のため今回は未検証)

…vpc destroy

During a live eks-production teardown, the AWS Load Balancer Controller
recreated a shared-IngressGroup ALB (+ its auto-created security groups)
after Step 10.4's one-shot tag sweep already ran, racing the bulk
`kubectl delete ingress --all`. The orphaned ALB then blocked IGW detach
and subnet/VPC deletion with DependencyViolation once the cluster (and
controller) was gone. Add a second, tag-based sweep right after the eks
stack is destroyed — the last point where recreation is impossible and
before alb/vpc destroy needs the dependency clear.

Also fix a stale `karpenter` stack name left over from the eks-karpenter
rename (#798) in the README's Module version requirements example.

Signed-off-by: panicboat <panicboat@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ef43087-9be9-4c40-bccd-9ec008c48da4


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@panicboat
panicboat marked this pull request as ready for review August 17, 2026 03:27
@panicboat
panicboat merged commit 1100792 into main Aug 17, 2026
7 checks passed
@panicboat
panicboat deleted the fix/eks-lifecycle-orphan-fallback-20260817 branch August 17, 2026 03:27
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.

1 participant