kubernetes/kops · error

no secrets found

Error message

no secrets found

What it means

After listing secrets, RunGetSecrets returns this error when the filtered result set is empty. It signals that the secret store has no secrets matching the requested names (or no secrets at all when no names were given), rather than printing an empty table.

Source

Thrown at cmd/kops/get_secrets.go:133

		return err
	}

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

	items, err := listSecrets(secretStore, options.SecretNames)
	if err != nil {
		return err
	}

	if len(items) == 0 {
		return fmt.Errorf("no secrets found")
	}
	switch options.Output {

	case OutputTable:
		t := &tables.Table{}
		t.AddColumn("NAME", func(i string) string {
			return i
		})
		return t.Render(items, out, "NAME")

	case OutputYaml:
		return fmt.Errorf("yaml output format is not (currently) supported for secrets")
	case OutputJSON:
		return fmt.Errorf("json output format is not (currently) supported for secrets")
	case "plaintext":
		for _, item := range items {
			var data string
			secret, err := secretStore.FindSecret(item)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Run `kops get secrets` with no name filter to see what exists
  2. Verify the secret name spelling
  3. Confirm you are targeting the right cluster with --name and the right state store with --state
  4. Create the secret with `kops create secret` if it does not exist

Example fix

// before
kops get secrets my-scret

// after
kops get secrets            # list all to find correct name
kops get secrets my-secret
Defensive patterns

Strategy: validation

Validate before calling

# check the secret exists before filtering:
kops get secrets | grep -q "^$SECRET_NAME$" || echo "secret not found: $SECRET_NAME"

Try / catch

items, err := listSecrets(store, names)
if err != nil {
	return err
}
if len(items) == 0 {
	return fmt.Errorf("no secrets found (cluster=%q, names=%v)", cluster, names)
}

Prevention

When it happens

Trigger: Running `kops get secrets` on a cluster whose secret store is empty, or `kops get secrets <name>` where no secret matches the given name(s).

Common situations: Typo in the secret name argument; querying a different cluster than the one holding the secret; secrets were deleted or never created for this cluster.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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