## TL;DR

Fix: get the ECDSA host key with ssh-keyscan -t ecdsa and update the known-hosts secret, the maintainer confirmed this resolves it. The underlying fix also shipped in source-controller (PR #1828), so updating Flux past that release is the durable fix.

## Steps

1. After upgrading Flux to 2.6.x, bootstrapping with SSH auth can fail with 'ssh: handshake failed: knownhosts: key mismatch'. Fix: get the ECDSA host key with ssh-keyscan -t ecdsa and update the known-hosts secret, the maintainer confirmed this resolves it. The underlying fix also shipped in source-controller (PR #1828), so updating Flux past that release is the durable fix. Rolling back to 2.5.1 is only a stopgap.

2. _Source: https://github.com/fluxcd/flux2/issues/5385 (Flux CD)_

## When to use

You are seeing this: After upgrading Flux to 2.6.x, bootstrapping with SSH auth can fail with 'ssh: handshake failed: knownhosts: key mismatch'. Use this skill when you run into "ssh: handshake failed: knownhosts: key mismatch".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 2.5.1. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/fluxcd/flux2/issues/5385
