kubernetes/kops · error
spotinst: unable to resolve image %q: not found
Error message
spotinst: unable to resolve image %q: not found
What it means
resolveImage wraps kops' AWSCloud.ResolveImage when provisioning a Spotinst Elastigroup. When the lookup succeeds but returns no image (nil), it reports that the requested AMI identifier/name could not be found. This means the given image name did not resolve to any AMI visible to the configured AWS credentials.
Source
Thrown at upup/pkg/fi/cloudup/spotinsttasks/elastigroup.go:1878
if e.Orientation == nil || (e.Orientation != nil && fi.ValueOf(e.Orientation) == "") {
e.Orientation = new("balanced")
}
if e.Monitoring == nil {
e.Monitoring = new(false)
}
if e.HealthCheckType == nil {
e.HealthCheckType = new("K8S_NODE")
}
}
func resolveImage(cloud awsup.AWSCloud, name string) (*ec2types.Image, error) {
image, err := cloud.ResolveImage(name)
if err != nil {
return nil, fmt.Errorf("spotinst: unable to resolve image %q: %v", name, err)
} else if image == nil {
return nil, fmt.Errorf("spotinst: unable to resolve image %q: not found", name)
}
return image, nil
}
func subnetSlicesEqualIgnoreOrder(l, r []*awstasks.Subnet) bool {
var lIDs []string
for _, s := range l {
lIDs = append(lIDs, *s.ID)
}
var rIDs []string
for _, s := range r {
if s.ID == nil {
klog.V(4).Infof("Subnet ID not set; returning not-equal: %v", s)
return false
}
rIDs = append(rIDs, *s.ID)View on GitHub (pinned to 4c8573c808)
Solutions
- Verify the image name/AMI ID exists in the target region (aws ec2 describe-images)
- Run kops get cluster --cloud aws and update the cluster spec's kubernetesVersion/image to a valid AMI for that region
- If using a custom AMI, confirm the AMI is shared with the account whose credentials kops uses
- Check AWS credentials/profile point to the intended account and region
Example fix
// before (cluster spec) image: ami-0abcdef1234567890 // after image: ami-0123456789abcdef0 # AMI present in the target region
Defensive patterns
Strategy: validation
Validate before calling
out, err := cloud.ResolveImage(name)
if err != nil {
return fmt.Errorf("resolving image %q: %w", name, err)
}
if out == nil {
return fmt.Errorf("image %q does not exist in region %s; check the AMI id/name", name, cloud.Region())
} Type guard
func imageFound(img *ec2types.Image) bool { return img != nil } Try / catch
if err != nil {
var notFound bool
if strings.Contains(err.Error(), "not found") {
notFound = true
}
if notFound {
// fall back to a region-appropriate default AMI
}
} Prevention
- Pin AMI IDs per region in the cluster spec
- Validate image names with aws ec2 describe-images before applying
- Keep credentials/profile aligned with the intended account and region
- Watch for deregistered/private AMIs after base-image updates
When it happens
Trigger: Calling create/update on an Elastigroup task whose Image field is an AMI name/alias that AWS APIs return no match for: cloud.ResolveImage(name) returns (nil, nil).
Common situations: Typo in AMI name; AMI does not exist in the target region; AMI is private or was deregistered; using a Debian/Ubuntu name without the image config; wrong AWS account/credentials.
Related errors
- spotinst: unable to resolve image %q: %v
- unable to resolve image: %q: %v
- error building ssh key: %v
- error building load balancers: %v
- error building public ip options: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/43ddc4f50a41b6ba.
Report an issue: GitHub.