kubernetes/kops · error

creating public ip addresses client: %w

Error message

creating public ip addresses client: %w

What it means

Wraps the failure of network.NewPublicIPAddressesClient, the azsdk client constructor. This client can fail construction because it must resolve an ARM endpoint and pipeline from the provided options; with nil options it typically fails only when subscriptionID is empty or credentials/options are invalid.

Source

Thrown at upup/pkg/fi/cloudup/azure/publicipaddress.go:89

	}
	return l, nil
}

func (c *publicIPAddressesClientImpl) Delete(ctx context.Context, resourceGroupName, publicIPAddressName string) error {
	future, err := c.c.BeginDelete(ctx, resourceGroupName, publicIPAddressName, nil)
	if err != nil {
		return fmt.Errorf("deleting public ip address: %w", err)
	}
	if _, err := future.PollUntilDone(ctx, nil); err != nil {
		return fmt.Errorf("waiting for public ip address deletion completion: %w", err)
	}
	return nil
}

func newPublicIPAddressesClientImpl(subscriptionID string, cred *azidentity.DefaultAzureCredential) (*publicIPAddressesClientImpl, error) {
	c, err := network.NewPublicIPAddressesClient(subscriptionID, cred, nil)
	if err != nil {
		return nil, fmt.Errorf("creating public ip addresses client: %w", err)
	}
	return &publicIPAddressesClientImpl{
		c: c,
	}, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Ensure a non-empty subscription ID is passed (check the cluster spec / AZURE_SUBSCRIPTION_ID)
  2. Verify the azidentity.DefaultAzureCredential was constructed without error before this call
  3. Check the Azure SDK module version for constructor API changes after an upgrade
  4. Re-run with AZURE_CLIENT_ID/SECRET/TENANT set if relying on environment credentials
Defensive patterns

Strategy: validation

Validate before calling

func validateAzureConfig(subscriptionID string) error {
  if strings.TrimSpace(subscriptionID) == "" {
    return errors.New("azure: subscription ID must be set (AZURE_SUBSCRIPTION_ID or cluster spec)")
  }
  return nil
}

Type guard

func clientConstructionFailed(err error) (bool, error) {
  var re *azcore.ResponseError
  if errors.As(err, &re) { return true, re }
  return err != nil, err
}

Try / catch

c, err := newPublicIPAddressesClientImpl(subID, cred)
if err != nil {
  return nil, fmt.Errorf("azure cloud init failed, check subscription ID and credentials: %w", err)
}

Prevention

When it happens

Trigger: newPublicIPAddressesClientImpl(subscriptionID, cred) is called (from newAzureCloud) with an empty subscription ID or a cred/options combination the SDK cannot build a pipeline for.

Common situations: --cloud-provider=azure configured without a subscription ID in the kOps cluster spec; AZURE_SUBSCRIPTION_ID unset/empty when building cloud via DefaultAzureCredential chain.

Related errors


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