kubernetes/kops · error

found instance %q, but state is %q

Error message

found instance %q, but state is %q

What it means

The EC2 instance backing the node was found via DescribeInstances, but its state is neither running nor pending (e.g. stopped, terminated, shutting-down). Node identity is refused because the instance is not considered operational.

Source

Thrown at pkg/nodeidentity/aws/identify.go:131

			klog.Warningf("Nodeidentity info cache lookup failure: %v", err)
		}
		if exists {
			return obj.(*nodeidentity.Info), nil
		}
	}

	// Based on node-authorizer code
	instance, err := i.getInstance(ctx, instanceID)
	if err != nil {
		return nil, err
	}

	var instanceState ec2types.InstanceStateName
	if instance.State != nil {
		instanceState = instance.State.Name
	}
	if instanceState != ec2types.InstanceStateNameRunning && instanceState != ec2types.InstanceStateNamePending {
		return nil, fmt.Errorf("found instance %q, but state is %q", instanceID, instanceState)
	}

	labels := map[string]string{}
	if len(instance.InstanceLifecycle) > 0 {
		labels[fmt.Sprintf("node-role.kubernetes.io/%s-worker", instance.InstanceLifecycle)] = "true"
	}

	info := &nodeidentity.Info{
		InstanceID: instanceID,
		Labels:     labels,
	}

	for _, tag := range instance.Tags {
		key := aws.ToString(tag.Key)
		if strings.HasPrefix(key, ClusterAutoscalerNodeTemplateLabel) {
			info.Labels[strings.TrimPrefix(aws.ToString(tag.Key), ClusterAutoscalerNodeTemplateLabel)] = aws.ToString(tag.Value)
		}
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Start the stopped EC2 instance or replace the node
  2. If the instance was replaced, remove the stale Node object so it can be re-registered
  3. Check the AWS console for why the instance left the running state
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/nodeidentity/aws/identify.go:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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