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

bored-table-20691

06/09/2021, 8:04 PM
I’ve deleted the EKS cluster that a bunch of my resources were deployed onto and created a new one (this is all with Pulumi in a different project/stack). In the stack that was in charge of those resources, I am trying to do a
pulumi up
, and it created resources on my new cluster just fine, but is failing to delete the old resources since that EKS cluster no longer exists. 1. Is this expected? 2. How should I get out of this situation? The old resources can’t really exist by definition anymore since the EKS cluster is gone.
pulumi refresh
errors out in the same way.
s

steep-toddler-94095

06/09/2021, 8:07 PM
if all the resources only existed on the k8s cluster you could just do a
pulumi stack rm
and start fresh
b

bored-table-20691

06/09/2021, 8:11 PM
There’s some stuff on S3 and RDS - I don’t have a problem nuking those, but probably would prefer to not orphan them (and would prefer to avoid doing it manually).
s

steep-toddler-94095

06/09/2021, 8:12 PM
ah. in that case i'd run
Copy code
pulumi state delete
for every k8s resource
b

bored-table-20691

06/09/2021, 8:15 PM
is there a way to find every resource that’s “pending deletion”
s

steep-toddler-94095

06/09/2021, 8:17 PM
i don't know... might have to parse the state file for that. but
pulumi stack --show-urns
will give you all the URNs in your stack so you can just grep/filter for kubernetes resources
b

bored-table-20691

06/09/2021, 8:19 PM
Copy code
$ pulumi state delete "urn:pulumi:tenant-itay8::okera-trial-tenants::kubernetes:apps/v1:Deployment::presto_coordinatorDeployment"
 warning: This command will edit your stack's state directly. Confirm? Yes
 Multiple resources with the given URN exist, please select the one to edit:  [Use arrows to move, enter to select, type to filter]
> "itay8/presto-coordinator"
  "itay8/presto-coordinator" (Pending Deletion)
Good to know multiple things with an URN can exist 🙂
b

billowy-army-68599

06/09/2021, 8:19 PM
it's expected behaviour yes, don't delete the cluster before you delete the resources, because otherwise the API to call no longer exists 😄
b

bored-table-20691

06/09/2021, 8:20 PM
Good to know 🙂 What’s the best way to get out of it? Just delete the URNs one by one and select the “pending deletion” ones?
b

billowy-army-68599

06/09/2021, 8:22 PM
yeah basically that's your best option. You might find it easier to do
pulumi stack export > stack.json
update the json to remove the resources
pulumi stack import --file stack.json
b

bored-table-20691

06/09/2021, 8:24 PM
In the stack.json, am I just looking for ones in which
"delete": true
is set?
since I seem to have two copies of each resource
OK that seemed to work
6 Views