kubernetes/kops · error
no cluster found
Error message
no cluster found
What it means
RunGetAll returns this hard-coded error when client.GetCluster succeeds (no transport/state-store error) but returns a nil cluster, meaning no cluster with the given name exists in the state store. It is a sentinel-style message indicating lookup returned empty rather than an error.
Source
Thrown at cmd/kops/get_all.go:87
},
}
return cmd
}
func RunGetAll(ctx context.Context, f commandutils.Factory, out io.Writer, options *GetAllOptions) error {
client, err := f.KopsClient()
if err != nil {
return err
}
cluster, err := client.GetCluster(ctx, options.ClusterName)
if err != nil {
return err
}
if cluster == nil {
return fmt.Errorf("no cluster found")
}
igList, err := client.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
if igList == nil || igList.Items == nil || len(igList.Items) == 0 {
fmt.Fprintf(os.Stderr, "No instance groups found\n")
}
var instancegroups []*api.InstanceGroup
for i := range igList.Items {
instancegroups = append(instancegroups, &igList.Items[i])
}
var addonObjects []*unstructured.Unstructured
{View on GitHub (pinned to 4c8573c808)
Solutions
- Run `kops get clusters` (or `kops get` with no args) to list clusters actually visible in the state store
- Verify KOPS_STATE_STORE points at the correct location (s3://bucket etc.) and credentials/profile can read it
- Use the exact full cluster name (FQDN) as registered, correcting typos
- Recreate the cluster or import state if the cluster config was deleted
Example fix
// before kops get all mycluster // after kops get clusters # confirm name kops get all mycluster.example.com
Defensive patterns
Strategy: validation
Validate before calling
clusters, err := client.ListClusters(ctx, nil)
if err != nil { return err }
found := false
for _, c := range clusters {
if c.ObjectMeta.Name == options.ClusterName { found = true; break }
}
if !found {
return fmt.Errorf("cluster %q not found in state store; run 'kops get clusters' to list", options.ClusterName)
} Type guard
if cluster == nil {
return fmt.Errorf("cluster %q not found", options.ClusterName)
} Try / catch
cluster, err := client.GetCluster(ctx, name)
if err != nil { return err }
if cluster == nil {
return fmt.Errorf("no cluster found for %q; check KOPS_STATE_STORE and exact cluster FQDN", name)
} Prevention
- Verify KOPS_STATE_STORE is set and readable before running get commands
- Always use the full cluster FQDN
- List clusters with `kops get clusters` to confirm names
- Confirm cloud credentials/profile can access the state store
When it happens
Trigger: `kops get all <name>` where <name> does not match any cluster in the configured state store, or KOPS_STATE_STORE points at the wrong/empty location, or the cluster name is misspelled.
Common situations: Wrong KOPS_STATE_STORE env var (e.g. pointing at a different bucket or an unset default); typo in cluster name or missing full DNS name (must be exact, e.g. mycluster.example.com, not just mycluster); cluster was deleted; running from a different AWS profile/account so the bucket/objects are invisible.
Related errors
- error querying cluster %q: %v
- cluster not found %q
- getting cluster: %q: %v
- error creating cluster: %v
- error writing additional objects: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d8e8a9e6e3a30a9f.
Report an issue: GitHub.