kubernetes/kops · error
found multiple SSH keys named %q
Error message
found multiple SSH keys named %q
What it means
Find() iterates all Linode SSH keys registered on the account looking for one whose Label matches the requested name. If a second key with the same label is encountered after one was already matched, the ambiguity is unrecoverable, so it aborts with this error instead of silently picking one.
Source
Thrown at upup/pkg/fi/cloudup/linodetasks/sshkey.go:65
name := fi.ValueOf(s.Name)
if name == "" {
return nil, fmt.Errorf("SSHKey.Name is required")
}
keys, err := cloud.Client().ListSSHKeys(c.Context(), nil)
if err != nil {
return nil, fmt.Errorf("error listing Akamai (Linode) SSH keys: %w", err)
}
var matched *linodego.SSHKey
for i := range keys {
key := &keys[i]
if key.Label != name {
continue
}
if matched != nil {
return nil, fmt.Errorf("found multiple SSH keys named %q", name)
}
matched = key
}
if matched == nil {
return nil, nil
}
actual := &SSHKey{
ID: new(matched.ID),
Name: new(matched.Label),
Lifecycle: s.Lifecycle,
}
if s.PublicKey != nil {
expectedPublicKey, err := fi.ResourceAsString(*s.PublicKey)
if err != nil {
return nil, fmt.Errorf("error rendering SSH key data: %w", err)View on GitHub (pinned to 4c8573c808)
Solutions
- List SSH keys on the account and delete or rename duplicates so only one key has that label (linode-cli sshkeys list / Cloud Manager)
- Delete stale keys from previous aborted cluster creates
- Use a unique cluster/key name in the kops cluster spec so labels don't collide
- If in dry-run only, this still fails: clean the account before running kops update
Example fix
// before: two keys labeled 'mycluster-key' on the account // after: // linode-cli sshkeys list # identify duplicate labels // linode-cli sshkeys delete <duplicate-id>
Defensive patterns
Strategy: validation
Validate before calling
keys, _ := client.ListSSHKeys(ctx, nil)
count := 0
for _, k := range keys {
if k.Label == name { count++ }
}
if count > 1 { return fmt.Errorf("duplicate SSH key labels for %q: clean up first", name) } Type guard
func uniqueSSHKey(keys []linodego.SSHKey, name string) *linodego.SSHKey {
var m *linodego.SSHKey
for i := range keys {
if keys[i].Label != name { continue }
if m != nil { return nil }
m = &keys[i]
}
return m
} Prevention
- Give each cluster's SSH key a globally unique label
- Clean up keys after aborted cluster creates
- Periodically audit account SSH keys for duplicate labels
When it happens
Trigger: Two or more linodego SSH keys exist on the account with identical Label values and kops calls Find for the SSHKey task with that label name.
Common situations: Manually re-adding the same cluster SSH key in the Linode Cloud Manager after a failed/aborted kops create, or sharing one Linode account across multiple clusters that each registered a key with the same label.
Related errors
- error rendering SSH key data: %w
- found SSH key %q in Akamai (Linode), but public key data did
- error creating Akamai (Linode) SSH key %q: %w
- found multiple Akamai (Linode) VPC Subnets named %q
- error parsing Akamai (Linode) %s ID %q: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/cceca83d309c122c.
Report an issue: GitHub.