kubernetes/kops · error

disk not found %q: %v

Error message

disk not found %q: %v

What it means

In Instance.Find, for the boot disk (source on the same project/zone), kOps does Disks().Get on the disk name parsed from the source URL. If GCE returns NotFound, the attached root disk cannot be found — the instance references a disk that no longer exists — and Find aborts instead of returning partial state.

Source

Thrown at upup/pkg/fi/cloudup/gcetasks/instance.go:121

	}

	for _, serviceAccount := range r.ServiceAccounts {
		for _, scope := range serviceAccount.Scopes {
			actual.Scopes = append(actual.Scopes, scopeToShortForm(scope))
		}
	}

	actual.Disks = make(map[string]*Disk)
	for i, disk := range r.Disks {
		if i == 0 {
			source := disk.Source

			// TODO: Parse source URL instead of assuming same project/zone?
			name := lastComponent(source)
			d, err := cloud.Compute().Disks().Get(cloud.Project(), *e.Zone, name)
			if err != nil {
				if gce.IsNotFound(err) {
					return nil, fmt.Errorf("disk not found %q: %v", source, err)
				}
				return nil, fmt.Errorf("error querying for disk %q: %v", source, err)
			}

			image, err := ShortenImageURL(cloud.Project(), d.SourceImage)
			if err != nil {
				return nil, fmt.Errorf("error parsing source image URL: %v", err)
			}
			actual.Image = new(image)
		} else {
			url, err := gce.ParseGoogleCloudURL(disk.Source)
			if err != nil {
				return nil, fmt.Errorf("unable to parse disk source URL: %q", disk.Source)
			}

			actual.Disks[disk.DeviceName] = &Disk{Name: &url.Name}
		}
	}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Recreate the disk or restore the instance so disk and instance agree: `gcloud compute instances describe <name> --zone=<zone>` to see the real disk
  2. Check the disk's actual zone matches e.Zone; if kops state is stale, re-import or update the instance spec
  3. If the instance itself is gone, remove it from the kops state/spec instead of refreshing
  4. Run `kops update cluster` to reconcile after fixing drift
Defensive patterns

Strategy: validation

Validate before calling

// Verify the boot disk exists in the same zone before refreshing instance state
name := lastComponent(source)
if _, err := cloud.Compute().Disks().Get(cloud.Project(), *e.Zone, name); err != nil {
	return fmt.Errorf("precheck: boot disk %q missing in zone %s: %w", name, *e.Zone, err)
}

Type guard

func diskExists(svc *compute.Service, project, zone, name string) bool {
	_, err := svc.Disks.Get(project, zone, name).Do()
	return err == nil
}

Prevention

When it happens

Trigger: Disks().Get(project, zone, name) returns IsNotFound: the boot disk was deleted while the instance reference remains (orphaned state), the disk is in a different zone than e.Zone, or state/spec holds a stale disk name.

Common situations: Disk manually deleted via console/gcloud while instance state persists in kops state store; instance and disk in mismatched zones after a migration; kops state store drift from manual cluster edits.

Related errors


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