https://pulumi.com logo
#kubernetes
Title
# kubernetes
b

bitter-microphone-25752

01/17/2024, 5:50 PM
I have a question on importing non-pulumi resources from an existing cluster. We use flux for CI/CD now with yaml manifests that deploys by 'kustomize build path/to/dir'. So 2 points: everything is thrown up at once and everything (from kustomize build) will be individual resources: Deployments, services, etc. We mocked that AKS workload (on KinD/minikube) using Pulumi objects including Helm Charts, kustomize directories, etc. Works great as we can now apply logic to our workloads : useful for kafka stacks where we want zookeepers up in multiple clusters before kafkas. So now we want to import existing resources from AKS. I generate a import.json file with all the resources from the AKS cluster where they will be listed as individual resources. So say I have a operator; the flux deployment will have deployed that as a Deployment, svc, sa, and that is how I must import them with
pulumi import ...
. But in the code I made for this stack - the code I want to use - that operator will be a helm.Chart object. So now running a
preview
or
up
will then instruct that the existing resources be deleted and replaced with the 'packaged' resources as part of a helm chart, say. So my question is the best approach to allow those resources be deleted and have the resources go up as i've coded them (so allow pulumi to
delete
the Deployment, svc, sa and
create
my pulumi helm.Chart)? We can of course make every resource an individual resource in my main.py, but we want to use helm Charts in our pulumi code as deployment is easier to manage plus it has a handy
ready
attribute
Tagging @stocky-restaurant-98004 after witnessing you preaching at the workshop today
s

stocky-restaurant-98004

01/17/2024, 11:17 PM
Just to recap, is the question is how to import K8s resources that were created outside of Pulumi?
Oh, I think I see: You specifically want to go from imported individual k8s resources to encapsulating them into a Helm chart. IDK about all k8s resources types, but Deployments wait until ready: https://www.pulumi.com/registry/packages/kubernetes/api-docs/apps/v1/deployment
2 Views