Skip to content

Add ssh key check for autoscaler#731

Open
privatecoder wants to merge 1 commit intovitobotta:mainfrom
privatecoder:add-ssh-key-check
Open

Add ssh key check for autoscaler#731
privatecoder wants to merge 1 commit intovitobotta:mainfrom
privatecoder:add-ssh-key-check

Conversation

@privatecoder
Copy link
Contributor

Attempted goal

  1. Set up a dev cluster with autoscaling nodes
  2. Be able to ssh into autoscaled nodes

Issues

• Could not ssh into autoscaled nodes, because the ssh key was not added to authorized_keys on the node
• After investigating I found that yout tool sets HCLOUD_SSH_KEY in the cluster‑autoscaler deployment to
settings.cluster_name so the autoscaler injects that key when it creates nodes.
• As I added the key before under a slightly different name, this did not work

Solution

Added a check, so that if any worker pool has autoscaling.enabled: true and addons.cluster_autoscaler.enabled: true, it:

  • Finds the SSH key by fingerprint or name.
  • If the key found has a different name than cluster_name, it aborts with a clear error that autoscaler won’t work.
  • If no key exists yet, it lets create proceed (hetzner‑k3s will create it).

If it fails, it prints:

[Configuration] - Cluster autoscaler requires an SSH key named 'dev' in Hetzner. A key with the same fingerprint exists as 'dev1', so hetzner-k3s will not create 'dev'. Autoscaled nodes will be created without SSH keys. Rename or delete the existing key, or change cluster_name.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments