kubermatic / kubeone

Kubermatic KubeOne automate cluster operations on all your cloud, on-prem, edge, and IoT environments.
https://kubeone.io
Apache License 2.0
1.39k stars 235 forks source link

respect IdentityFile ssh config when using ssh agent socket #3356

Open tompson opened 3 months ago

tompson commented 3 months ago

What happened?

We are using 1Password SSH Agent for managing our ssh keys

the SSH_AUTH_SOCK is set to the 1Password agent

when trying to run kubeone we get the following error:

kubeone apply --manifest kubeone.yaml -t output.json --verbose
INFO[11:53:34 CEST] Determine hostname...
ERRO[11:53:34 CEST] ssh: dialing
connection to: 5.75.143.85:22
ssh: handshake failed: ssh: disconnect, reason 2: Too many authentication failures  node=23.24.55.66

this is because there are more than 6 ssh keys in the agent available

it seems that kubeone does not respect the IdentityFile set in ~/.ssh/config like

Host 23.24.55.66
    IdentityFile ~/.ssh/public-key-for-kubeone.pub

Expected behavior

kubeone should respect the IdentityFile ssh config for the hosts

How to reproduce the issue?

add more than 6 ssh keys to the ssh agent and make sure that the one fitting for the host is ordered last

What KubeOne version are you using?

```console $ kubeone version { "kubeone": { "major": "1", "minor": "8", "gitVersion": "1.8.0", "gitCommit": "c280d14d95ac92a27576851cc058fc84562fcc55", "gitTreeState": "", "buildDate": "2024-05-14T15:41:44Z", "goVersion": "go1.22.3", "compiler": "gc", "platform": "darwin/amd64" }, "machine_controller": { "major": "1", "minor": "59", "gitVersion": "v1.59.1", "gitCommit": "", "gitTreeState": "", "buildDate": "", "goVersion": "", "compiler": "", "platform": "linux/amd64" } } ```

What cloud provider are you running on?

Hetzner Cloud

What operating system are you running in your cluster?

Ubuntu 22.04

kron4eg commented 3 months ago

Unfortunately we don't have any support for ~/.ssh/config.