vitobotta / hetzner-k3s

The easiest and quickest way to create and manage Kubernetes clusters in Hetzner Cloud using the lightweight distribution k3s by Rancher.
MIT License
1.59k stars 113 forks source link

hetzner-k3s delete does not remove worker pool placement groups #321

Open shadshar opened 5 months ago

shadshar commented 5 months ago

Hi! When running hetzner-k3s delete, it uses the wrong names when it refers to the names of the worker pool placement groups that were created. On creation, the placement groups get named name-X, where X is a number. That number is not being used during the deletion process, so the placement groups remain and need to be deleted by hand using the cloud console.

So for example, with a config snippet as follows:

worker_node_pools:
- name: small-static-1
  instance_type: cax11
  instance_count: 2
  location: nbg1
  labels:
    - key: purpose
      value: k3s-worker
- name: small-static-2
  instance_type: cax11
  instance_count: 2
  location: nbg1
  labels:
    - key: purpose
      value: k3s-worker

During creation, the output confirms the creation like this:

Creating placement group k3s-playground-masters...done.
Creating placement group k3s-playground-small-static-1-1...done.
Creating placement group k3s-playground-small-static-2-1...done.

And deletion fails like this:

Deleting placement group k3s-playground-masters...done.
Placement group k3s-playground-small-static-1 does not exist, skipping.
Placement group k3s-playground-small-static-2 does not exist, skipping.
vitobotta commented 4 months ago

Hi, yeah I'm aware of this and it's on my list of things to fix for the next release. Placement groups don't cost money nor cause any problems so I haven't given this higher priority.

vitobotta commented 3 months ago

Ref. project card https://github.com/users/vitobotta/projects/4/views/1?filterQuery=placement&pane=issue&itemId=59546489

peterdieleman commented 2 months ago

Not sure this is the right place to comment as this is about placement groups, but: I have set up a project and ran create/delete repeatedly (very cool stuff :) ). I also went through the README and found:

NOTE: at the moment instances created by the cluster autoscaler, as well as load balancers and persistent volumes created by deploying your applications must be deleted manually. This may be addressed in a future release.

I would actually say that not deleting the LB can be quite a nice behaviour. When combining it together with something like Cloudflare DNS it avoids reconfiguring the IP in CF. I guess the default should be to delete it as people may run into unexpected costs, but perhaps this behaviour (not deleting the LB) could be supported through a flag.

vitobotta commented 2 months ago

Not sure this is the right place to comment as this is about placement groups, but: I have set up a project and ran create/delete repeatedly (very cool stuff :) ). I also went through the README and found:

NOTE: at the moment instances created by the cluster autoscaler, as well as load balancers and persistent volumes created by deploying your applications must be deleted manually. This may be addressed in a future release.

I would actually say that not deleting the LB can be quite a nice behaviour. When combining it together with something like Cloudflare DNS it avoids reconfiguring the IP in CF. I guess the default should be to delete it as people may run into unexpected costs, but perhaps this behaviour (not deleting the LB) could be supported through a flag.

The README doesn't expand on this but the idea is to ask the user for a confirmation before deleting load balancers and persistent volumes, so you can choose :)