kubernetes/kops · error

DetachInstance not implemented on azureCloud

Error message

DetachInstance not implemented on azureCloud

What it means

Detaching an individual instance from its cloud group (used by rolling-update --cloud-azure style flows to detach then drain then delete a node) is not implemented on Azure; the method always returns this error.

Source

Thrown at upup/pkg/fi/cloudup/azure/azure_cloud.go:256

func (c *azureCloudImplementation) DeleteInstance(i *cloudinstances.CloudInstance) error {
	vmssName := i.CloudInstanceGroup.HumanName
	instanceID := strings.TrimPrefix(i.ID, vmssName+"_")
	return c.vmscaleSetVMsClient.Delete(context.TODO(), c.resourceGroupName, vmssName, instanceID)
}

// DeregisterInstance drains a cloud instance and loadbalancers.
func (c *azureCloudImplementation) DeregisterInstance(i *cloudinstances.CloudInstance) error {
	klog.V(8).Info("Azure DeregisterInstance not implemented")
	return nil
}

func (c *azureCloudImplementation) DeleteGroup(g *cloudinstances.CloudInstanceGroup) error {
	return errors.New("DeleteGroup not implemented on azureCloud")
}

func (c *azureCloudImplementation) DetachInstance(i *cloudinstances.CloudInstance) error {
	return errors.New("DetachInstance not implemented on azureCloud")
}

// AddClusterTags adds cluster tags to the resource.
func (c *azureCloudImplementation) AddClusterTags(tags map[string]*string) {
	for k, v := range c.tags {
		tags[k] = &v
	}
}

func (c *azureCloudImplementation) GetApiIngressStatus(cluster *kops.Cluster) ([]fi.ApiIngressStatus, error) {
	var ingresses []fi.ApiIngressStatus
	rg := cluster.AzureResourceGroupName()

	lbSpec := cluster.Spec.API.LoadBalancer
	if lbSpec != nil {
		// Get load balancers in cluster resource group
		lbs, err := c.loadBalancersClient.List(context.TODO(), rg)
		if err != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Do not use instance detach on Azure; rely on standard rolling update without --detach or equivalent
  2. Remove the VM from the VMSS/availability set directly in Azure if detach semantics are required
  3. Implement DetachInstance for Azure by removing the vm from the scale set (vmssClient update/delete)
  4. Upgrade kops to a version with Azure detach support
Defensive patterns

Strategy: try-catch

Validate before calling

if c.ProviderID() == kops.CloudProviderAzure && requireDetach {
	return fmt.Errorf("instance detach is unsupported on Azure")
}

Try / catch

if err := cloud.DetachInstance(inst); err != nil {
	if strings.Contains(err.Error(), "DetachInstance not implemented on azureCloud") {
		// skip detach; proceed with drain-only flow
	} else { return err }
}

Prevention

When it happens

Trigger: Calling cloud.DetachInstance(i) on an Azure CloudInstance — typically from the rolling-update detach/drain machinery when DetachInstance option is enabled.

Common situations: Rolling update with detachment enabled on an Azure cluster; drain-and-detach automation ported from AWS to Azure; chaos/node-removal tooling calling the generic CloudInstance detach API.

Related errors


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