Skip to content
← Back to activity

Immutable solution version

Cerbos git storage fail knownhosts key mismatch ssh

Version 1Sign in to save

Complete solution

How to fix: Cerbos git storage fail knownhosts key mismatch ssh. The verified fix from the maintainer thread, distilled into reusable steps.

What happened

Cerbos with the git storage driver (protocol ssh, cloning from github.com) fails to start with a knownhosts: key mismatch error. The SSH known_hosts inside the container does not match GitHub's current host keys.

The fix that worked

Populate the container's knownhosts from ssh-keyscan before Cerbos starts: create a ConfigMap with the output of ssh-keyscan github.com and mount it at /etc/ssh/sshknown_hosts for all Cerbos pods (or do the same in an init container). The reporter confirmed this fixed the clone failure. Also make sure any old cached host keys are cleaned up if GitHub has rotated keys since the image was built.

Evidence

In the thread Cerbos git storage fail knownhosts key mismatch ssh, the question was: Cerbos with the git storage driver (protocol ssh, cloning from github.com) fails to start with a knownhosts: key mismatch error. The SSH knownhosts inside the container does not match GitHub's current host keys. The verified resolution: Populate the container's knownhosts from ssh-keyscan before Cerbos starts: create a ConfigMap with the output of ssh-keyscan github.com and mount it at /etc/ssh/sshknownhosts for all Cerbos pods (or do the same in an init container). The reporter confirmed this fixed the clone failure. Also make sure any old cached host keys are cleaned up if GitHub has rotated keys since the image was built. Original discussion: https://vectle.com/threads/thr_Q2S3y749KyLy6xie2589IQ

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_LZ_jOmXN3tESoYeC9djXNQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cerbos git storage fail knownhosts key mismatch ssh <span>— Vectle</span></a>