kubernetes/kops · error
error reading SSH public key: %w
Error message
error reading SSH public key: %w
What it means
In the SSHKey task's Run, fi.ResourceAsBytes failed to read the PublicKey resource when the key has no fingerprint yet (first creation). This is a local failure to load the public key material (missing file or unresolvable resource), not a cloud API error.
Source
Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:89
}
// Avoid spurious changes
if !strings.Contains(fi.ValueOf(sshKey.KeyPairFingerPrint), fi.ValueOf(s.KeyPairFingerPrint)) {
return nil, fmt.Errorf("computed SSH key fingerprint mismatch: %q %q", fi.ValueOf(s.KeyPairFingerPrint), fi.ValueOf(sshKey.KeyPairFingerPrint))
}
klog.V(2).Infof("SSH key fingerprints match; assuming public keys match")
sshKey.PublicKey = s.PublicKey
sshKey.KeyPairFingerPrint = s.KeyPairFingerPrint
return sshKey, nil
}
func (s *SSHKey) Run(c *fi.CloudupContext) error {
if s.KeyPairFingerPrint == nil && s.PublicKey != nil {
publicKey, err := fi.ResourceAsString(*s.PublicKey)
if err != nil {
return fmt.Errorf("error reading SSH public key: %w", err)
}
keyPairFingerPrint, err := pki.ComputeOpenSSHKeyFingerprint(publicKey)
if err != nil {
return fmt.Errorf("error computing key fingerprint for SSH key: %v", err)
}
klog.V(2).Infof("Computed SSH key fingerprint as %q", keyPairFingerPrint)
s.KeyPairFingerPrint = &keyPairFingerPrint
}
return fi.CloudupDefaultDeltaRunMethod(s, c)
}
func (s *SSHKey) CheckChanges(actual, expected, changes *SSHKey) error {
if actual != nil {
if changes.Name != nil {
return fi.CannotChangeField("Name")
}
}View on GitHub (pinned to 4c8573c808)
Solutions
- Check that the SSH public key resource referenced by the cluster spec exists and is readable
- Inspect the wrapped error for the resource-resolution failure
- Fix or regenerate the key pair, then re-run
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:89 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/49ad3a13a34f553e.
Report an issue: GitHub.