kubernetes/kops · error

address not found %q: %v

Error message

address not found %q: %v

What it means

During Find, if an instance has a NatIP but no static GCE address matching that IP exists in the region, kOps fails with 'address not found'. Note the %v placeholder is filled with err, which is nil in this branch, so the message ends with '<nil>'. It signals an ephemeral (non-reserved) external IP or a mismatched address record.

Source

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

	actual.MachineType = new(lastComponent(r.MachineType))
	actual.CanIPForward = &r.CanIpForward
	if r.Scheduling != nil {
		actual.Preemptible = &r.Scheduling.Preemptible
	}
	if len(r.NetworkInterfaces) != 0 {
		ni := r.NetworkInterfaces[0]
		actual.Network = &Network{Name: new(lastComponent(ni.Network))}
		actual.StackType = &ni.StackType
		if len(ni.AccessConfigs) != 0 {
			ac := ni.AccessConfigs[0]
			if ac.NatIP != "" {
				addrs, err := cloud.Compute().Addresses().ListWithFilter(cloud.Project(), cloud.Region(), "address eq "+ac.NatIP)
				if err != nil {
					return nil, fmt.Errorf("error querying for address %q: %v", ac.NatIP, err)
				} else if len(addrs) != 0 {
					actual.IPAddress = &Address{Name: &addrs[0].Name}
				} else {
					return nil, fmt.Errorf("address not found %q: %v", ac.NatIP, err)
				}
			}
		}
	}

	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)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Reserve the IP: `gcloud compute addresses create <name> --addresses=<NatIP> --region=<region>` and reference it via the kops spec, or clear the instance's IPAddress field so kOps treats it as ephemeral
  2. Confirm the address exists in the same region/project as the instance
  3. Check whether another task/spec references a deleted Address task and re-create it

Example fix

// before (kops cluster spec expecting a static IP that no longer exists)
api:
  loadBalancer... / instance with ipAddress: my-static-ip
// after
either recreate the address task/resource, or remove ipAddress so an ephemeral IP is used
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the NatIP is a reserved address in the region before Find runs
func assertReservedAddress(project, region, natIP string, svc *compute.Service) error {
	addrs, err := svc.Addresses.List(project, region).Filter("address eq "+natIP).Do()
	if err != nil { return err }
	if len(addrs.Items) == 0 {
		return fmt.Errorf("%s is ephemeral or not reserved in %s; reserve it or drop the static-IP assumption", natIP, region)
	}
	return nil
}

Type guard

func hasReservedAddress(addrs []*compute.Address, natIP string) bool {
	for _, a := range addrs { if a.Address == natIP { return true } }
	return false
}

Prevention

When it happens

Trigger: Instance's AccessConfig[0].NatIP is set, the address-list query succeeds but returns zero results — the IP is ephemeral, the static address is in another region/project, or was released and the IP reassigned as ephemeral.

Common situations: Instance using an ephemeral external IP instead of a reserved one; someone deleted the reserved address; kops state expecting an IPAddress resource that no longer exists; address reserved in a different region.

Related errors


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