kubernetes/kops · error
error querying cluster %q: %v
Error message
error querying cluster %q: %v
What it means
After reading the cluster-name label from an InstanceGroup, RunCreate calls clientset.GetCluster to fetch the parent cluster. If that backend lookup returns an error (storage/backend failure, not the not-found case), it is wrapped in this message with the cluster name and underlying error.
Source
Thrown at cmd/kops/create.go:163
_, err = clientset.CreateCluster(ctx, v)
if err != nil {
if apierrors.IsAlreadyExists(err) {
return fmt.Errorf("cluster %q already exists", v.ObjectMeta.Name)
}
return fmt.Errorf("error creating cluster: %v", err)
}
fmt.Fprintf(&sb, "Created cluster/%s\n", v.ObjectMeta.Name)
clusters = append(clusters, v)
// cSpec = true
case *kopsapi.InstanceGroup:
clusterName = v.ObjectMeta.Labels[kopsapi.LabelClusterName]
if clusterName == "" {
return fmt.Errorf("must specify %q label with cluster name to create instanceGroup", kopsapi.LabelClusterName)
}
cluster, err := clientset.GetCluster(ctx, clusterName)
if err != nil {
return fmt.Errorf("error querying cluster %q: %v", clusterName, err)
}
if cluster == nil {
return fmt.Errorf("cluster %q not found", clusterName)
}
_, err = clientset.InstanceGroupsFor(cluster).Create(ctx, v, metav1.CreateOptions{})
if err != nil {
if apierrors.IsAlreadyExists(err) {
return fmt.Errorf("instanceGroup %q already exists", v.ObjectMeta.Name)
}
return fmt.Errorf("error creating instanceGroup: %v", err)
}
fmt.Fprintf(&sb, "Created instancegroup/%s\n", v.ObjectMeta.Name)
case *kopsapi.SSHCredential:
clusterName = v.ObjectMeta.Labels[kopsapi.LabelClusterName]
if clusterName == "" {View on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped %v detail to identify the backend failure
- Verify KOPS_STATE_STORE points at the correct store (e.g. s3://<bucket>) and credentials work (`aws s3 ls $KOPS_STATE_STORE`)
- Confirm the cluster manifest exists in the store (`kops get clusters`)
- Retry after fixing network/permissions
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("KOPS_STATE_STORE") == "" {
return fmt.Errorf("KOPS_STATE_STORE must be set")
}
// pre-check backend reachability
if _, err := clientset.GetCluster(ctx, name); err != nil {
return fmt.Errorf("state store unreachable: %v", err)
} Try / catch
if err := runCreate(); err != nil {
var se *StateStoreError
if strings.Contains(err.Error(), "error querying cluster") {
// check KOPS_STATE_STORE, credentials, network, then retry
}
} Prevention
- Pin KOPS_STATE_STORE in CI and shell profiles
- Verify cloud credentials before kops create runs
- Test state store access with `kops get clusters` first
When it happens
Trigger: `kops create -f ig.yaml` with a properly labeled InstanceGroup where GetCluster against the state store fails — e.g. unreachable/misspelled KOPS_STATE_STORE, bad credentials, malformed s3:// path, or network/permission error reading the cluster manifest.
Common situations: KOPS_STATE_STORE env var wrong or unset in CI; S3 bucket deleted or IAM permissions revoked; using a state store path for a different region; VPN/network outage on a developer machine.
Related errors
- error getting cluster: %q: %v
- adding encryptionconfig secret: %v
- updating encryptionconfig secret: %v
- no cluster found
- cluster not found %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/878dd63f786eac36.
Report an issue: GitHub.