kubernetes/kops · error

error reading SSH public key: %v

Error message

error reading SSH public key: %v

What it means

Wraps fi.ResourceAsString failure while reading the SSH public key resource in Normalize, done to derive the key fingerprint when it was not supplied. Fires when the PublicKey resource cannot be materialized into a string.

Source

Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:103

	}
	actual.Lifecycle = e.Lifecycle

	e.ID = actual.ID
	if e.IsExistingKey() && *e.Name != "" {
		e.KeyFingerprint = actual.KeyFingerprint
	}

	// We aren't allowed two keys with the same fingerprint but different names...
	e.Name = actual.Name

	return actual, nil
}

func (e *SSHKey) Normalize(c *fi.CloudupContext) error {
	if e.KeyFingerprint == nil && e.PublicKey != nil {
		publicKey, err := fi.ResourceAsString(e.PublicKey)
		if err != nil {
			return fmt.Errorf("error reading SSH public key: %v", err)
		}

		keyFingerprint, err := pki.ComputeAWSKeyFingerprint(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", keyFingerprint)
		e.KeyFingerprint = &keyFingerprint
	}

	return nil
}

func (e *SSHKey) Run(c *fi.CloudupContext) error {
	return fi.CloudupDefaultDeltaRunMethod(e, c)
}

func (s *SSHKey) CheckChanges(a, e, changes *SSHKey) error {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the public key resource/config in the cluster spec
  2. Inspect the wrapped read error
  3. Fix the key reference and re-run
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:103 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/c4ab06a0fc5e8277. Report an issue: GitHub.