kubernetes/kops · error

unable to find specified SSH key %q

Error message

unable to find specified SSH key %q

What it means

Lookup guard in the DO SSH-key Find: the fingerprint lookup returned 404, but the key was declared as pre-existing (IsExistingKey) with a name, so kOps cannot adopt a key that does not exist in the account. Unlike non-existing keys, this is a hard error because the user explicitly referenced the key.

Source

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

	return e.Name
}

func (e *SSHKey) Find(c *fi.CloudupContext) (*SSHKey, error) {
	ctx := c.Context()

	cloud := c.T.Cloud.(do.DOCloud)

	return e.find(ctx, cloud)
}

func (e *SSHKey) find(ctx context.Context, cloud do.DOCloud) (*SSHKey, error) {
	// We aren't allowed to have two keys with the same fingerprint here.
	// So if we find a matching key, we use that one (with that name).

	k, response, err := cloud.KeysService().GetByFingerprint(ctx, *e.KeyFingerprint)
	if response.StatusCode == 404 {
		if e.IsExistingKey() && *e.Name != "" {
			return nil, fmt.Errorf("unable to find specified SSH key %q", *e.Name)
		}
		return nil, nil
	}
	if err != nil {
		return nil, fmt.Errorf("error listing SSH keys: %w", err)
	}

	actual := &SSHKey{
		ID:             &k.ID,
		Name:           &k.Name,
		KeyFingerprint: &k.Fingerprint,
	}

	if fi.ValueOf(actual.KeyFingerprint) == fi.ValueOf(e.KeyFingerprint) {
		klog.V(2).Infof("SSH key fingerprints match; assuming public keys match")
		actual.PublicKey = e.PublicKey
	} else {
		klog.V(2).Infof("Computed SSH key fingerprint mismatch: %q %q", fi.ValueOf(e.KeyFingerprint), fi.ValueOf(actual.KeyFingerprint))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Upload the SSH public key to DigitalOcean
  2. Fix the key name/fingerprint in the cluster spec
  3. Or remove the existing-key designation so kOps creates a key
Defensive patterns

Strategy: validation

When it happens

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