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
- Run `kops get secrets` with no name filter to see what exists
- Verify the secret name spelling
- Confirm you are targeting the right cluster with --name and the right state store with --state
- 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
- List all secrets first, then filter
- Verify cluster name and state store before querying
- Confirm secrets were created for this cluster
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
- cluster %q not found
- cannot find secret %q
- instanceGroup: %v does not exist (try adding --force flag)
- must specify %q label with cluster name to create instanceGr
- error querying cluster %q: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/09d0e336b16fe001.
Report an issue: GitHub.