kubernetes/kops · error

failed to delete instance IP %s: %w

Error message

failed to delete instance IP %s: %w

What it means

deleteServerIP removes a single Scaleway flexible IP tracked for cluster deletion. If the InstanceService DeleteIP call fails, the error is wrapped with the IP address for identification. This occurs per-resource during the delete loop and contributes to no-progress/timeout failures if persistent.

Source

Thrown at pkg/resources/scaleway/resources.go:243

}

func deleteServer(cloud fi.Cloud, tracker *resources.Resource) error {
	c := cloud.(scaleway.ScwCloud)
	server := tracker.Obj.(*instance.Server)

	return c.DeleteServer(server)
}

func deleteServerIP(cloud fi.Cloud, tracker *resources.Resource) error {
	c := cloud.(scaleway.ScwCloud)
	ip := tracker.Obj.(*instance.IP)

	err := c.InstanceService().DeleteIP(&instance.DeleteIPRequest{
		Zone: ip.Zone,
		IP:   ip.ID,
	})
	if err != nil {
		return fmt.Errorf("failed to delete instance IP %s: %w", ip.Address.String(), err)
	}

	return nil
}

func deleteSSHKey(cloud fi.Cloud, tracker *resources.Resource) error {
	c := cloud.(scaleway.ScwCloud)
	sshkey := tracker.Obj.(*iam.SSHKey)

	return c.DeleteSSHKey(sshkey)
}

func deleteVolume(cloud fi.Cloud, tracker *resources.Resource) error {
	c := cloud.(scaleway.ScwCloud)
	volume := tracker.Obj.(*instance.Volume)

	return c.DeleteVolume(volume)
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Re-run the delete — if the IP was already deleted (404), a fresh ListResources pass will drop it from the set
  2. Verify the Scaleway credentials include permission to delete IPs (instance:* on the project)
  3. Check the IP still exists with `scw instance ip list` and delete it manually if the API keeps failing
  4. Retry with backoff if the error is 429/5xx throttling during bulk deletion

Example fix

// before
scw instance ip delete ip-id=<id> # fails: permissions
// after: grant instance delete scope to the credential, then
kops delete cluster --name mycluster --yes
Defensive patterns

Strategy: retry

Validate before calling

// Confirm the IP still exists before deleting to avoid 404s
_, err := c.InstanceService().GetIP(&instance.GetIPRequest{Zone: ip.Zone, IP: ip.ID})
if err != nil && scw.IsNotFoundError(err) {
    return nil // already deleted
}

Try / catch

if err := deleteServerIP(cloud, tracker); err != nil {
    var apiErr *scw.Error
    if errors.As(err, &apiErr) && apiErr.StatusCode == http.StatusNotFound {
        return nil // already gone — treat as success
    }
    return backoffRetry(err)
}

Prevention

When it happens

Trigger: DeleteResources invokes deleteServerIP (pkg/resources/scaleway/resources.go:243) and Instance API DeleteIP fails: IP already deleted (404), credentials lack permission, wrong zone in the tracked IP, or API throttling/transient errors.

Common situations: A concurrent deletion already removed the IP (404 on retry); IAM policy on the Scaleway project denies instance:DeleteIP; zone drift between listing and deletion; Scaleway rate limits during mass deletion of a large cluster.

Related errors


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