Why are Kubernetes Manifests Deploying with My EKS Stack in CDK?

0
7
Asked By TechyDude42 On

I've set up a CDK app where I'm using separate stacks for my VPC, RDS/S3 persistence, an EKS cluster, and an API stack. I wanted to keep everything organized so that each application gets its own stack for Kubernetes deployments. The idea was to be able to create or delete these applications without impacting the rest of my resources. However, when I deploy my EKS stack, it ends up deploying Kubernetes manifests defined in my other, not-yet-deployed stacks. I suspect this might be due to CloudFormation's inability to directly handle internal Kubernetes items. Can anyone clarify why this happens and how I can manage this in CDK effectively?

2 Answers

Answered By CloudNinja09 On

Make sure to double-check the deployment command you're using. Deploying with `cdk deploy MyStackName` will deploy that specific stack and any of its dependencies. If your stacks are tightly coupled, even though they're separate, it can lead to manifests from one stack being triggered during another's deployment. You might need to adjust the stack dependencies to achieve the separation you're aiming for.

Answered By CodeWizard88 On

It sounds like your CDK setup might be mixing dependencies across stacks. When you declare manifests with `cluster.addManifest(...)`, they can inadvertently get attached to the deployment of the EKS stack. To keep things more isolated, consider setting up a separate way to handle those resources, perhaps with Stack Outputs. This could help ensure that deploying the EKS stack doesn’t trigger the others to deploy prematurely. Plus, if you consolidate your Kubernetes resources into a single or tightly controlled stack, you'll have better visibility and control over what's being deployed when.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.