kubernetes/kops · error

use 'kops get sshpublickey' instead

Error message

use 'kops get sshpublickey' instead

What it means

RunGetSecrets rejects the type 'sshpublickey' because SSH public keys were moved to their own dedicated command. The legacy `kops get secrets --type sshpublickey` path is no longer supported; users must use `kops get sshpublickey`.

Source

Thrown at cmd/kops/get_secrets.go:106

		nameSet := sets.NewString(names...)
		var matches []string
		for _, item := range items {
			if nameSet.Has(item) {
				matches = append(matches, item)
			}
		}
		items = matches
	}

	return items, nil
}

func RunGetSecrets(ctx context.Context, f *util.Factory, out io.Writer, options *GetSecretsOptions) error {
	switch strings.ToLower(options.Type) {
	case "", "secret":
	// OK
	case "sshpublickey":
		return fmt.Errorf("use 'kops get sshpublickey' instead")
	case "keypair":
		return fmt.Errorf("use 'kops get keypairs' instead")
	default:
		return fmt.Errorf("unknown secret type %q", options.Type)
	}

	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	cluster, err := GetCluster(ctx, f, options.ClusterName)
	if err != nil {
		return err
	}
	secretStore, err := clientset.SecretStore(cluster)
	if err != nil {
		return err

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `kops get sshpublickey` instead of `kops get secrets --type sshpublickey`
  2. Update automation scripts to use the dedicated subcommand

Example fix

// before
kops get secrets --type sshpublickey

// after
kops get sshpublickey
Defensive patterns

Strategy: validation

Validate before calling

if [ "$SECRET_TYPE" = "sshpublickey" ]; then
  echo "use 'kops get sshpublickey' instead"; exit 1
fi

Prevention

When it happens

Trigger: Running `kops get secrets --type sshpublickey` (case-insensitive match).

Common situations: Older scripts or docs written before the sshpublickey subcommand split; muscle memory from kops versions where keys were managed as secrets.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/7236f4684cac8546. Report an issue: GitHub.