https://pulumi.com logo
#getting-started
Title
# getting-started
b

better-park-30599

02/22/2023, 9:52 PM
Hi all, I'm trying to understand the best practices around managing a lot of different k8s clusters with one pulumi codebase. We're going to start with something like a dozen clusters or so, but plan to scale that up to the hundreds within a year or so, across several different cloud providers. Would it be best to think about making one project for each cluster? Or just one project for each cloud provider, with a stack for each k8s cluster? Assuming the latter, the only difference in each stack should be what's in the yaml, right? But should each of those yamls be in separate directories? Any guidance or examples would be greatly appreciated, thank you!
s

steep-toddler-94095

02/22/2023, 10:39 PM
one project for each cloud provider, with a stack for each k8s cluster
I would definitely go with this
the only difference in each stack should be what's in the yaml, right
correct. don't put the stack yamls in separate directories (I'm not even sure if you can?). It's up to you, but I personally rely minimally on the Stack yaml files for complex stacks. I instead use the programming language to construct the configurations for each stack. You can be more expressive that way and you can have type-safety too.
b

better-park-30599

02/22/2023, 10:41 PM
Thanks @steep-toddler-94095 - so something like this, right?
Copy code
\source-repo
 \projects
  \aws-clusters
   __main__.py
   Pulumi.aws-cluster1.yaml
   Pulumi.aws-cluster2.yaml
  \gcp-clusters
   __main__.py
   Pulumi.gcp-cluster1.yaml
   Pulumi.gcp-cluster2.yaml
s

steep-toddler-94095

02/22/2023, 10:44 PM
yup
f

few-wolf-27303

02/23/2023, 4:10 AM
We use branches instead to do this. That way you have a cleaner way of tracking changes and sort of gives you more separation of environments.
b

better-park-30599

02/23/2023, 5:24 AM
interesting, thanks
2 Views