Hi guys! Nice to meet you, my name is Diogo! I'm ...
# general
b
Hi guys! Nice to meet you, my name is Diogo! I'm using Pulumi to setup both the infrastructure and the application itself for a certain service that I need to spin up, and this includes setting up a cluster for it as well. This is on GKE, and the application is (obviously) a bunch of manifests built with Pulumi. All running as GitHub Actions. However, I have a chicken-and-egg problem: The infra code creates the cluster, but for the app code to apply it needs the kubeconfig to be available, but I can only setup the kubeconfig if the cluster is already up (using
google-github-actions/get-gke-credentials@v2
), and this can't be done because at this point the cluster is not yet up. Is there a way to make all of this work in a single shot? Or do I have to strictly separate the cluster setup from the app setup?
d
You can generate the kubeconfig to be used with the kubernetes provider: https://github.com/pulumi/examples/blob/267aba12c943d7a8032dee2676d1b8ab0a344695/gcp-ts-gke/cluster.ts#L43
I'd recommend keeping app deployment in a separate stack to cluster creation/management though
b
Ah, cool, thanks! 🙂
@dry-keyboard-94795 is there any documentation about good practices for separating IaC from app/manifest code? Like, how to properly structure configs + directory structure etc
s
I, too, would recommend separating the cluster and the application into separate stacks---they (quite likely) have different lifecycles.
b
Mostly, yes, but since I'm doing this for a self-managed service that's built by a third party, I'm putting it all together. In general, though, that's a good point, I agree 🙂