kubernetes/kops · error
creating/updating disk: %w
Error message
creating/updating disk: %w
What it means
The DisksClient.CreateOrUpdate wrapper calls armcompute's BeginCreateOrUpdate to create or update a managed disk. Any error returned synchronously by the Azure Resource Manager API (before a polling future can be created) is wrapped as "creating/updating disk: %w". Typical wrapped causes are invalid request payload, authentication/authorization failures, or the resource group/subscription not resolving.
Source
Thrown at upup/pkg/fi/cloudup/azure/disk.go:45
)
// DisksClient is a client for managing disks.
type DisksClient interface {
CreateOrUpdate(ctx context.Context, resourceGroupName, diskName string, parameters compute.Disk) (*compute.Disk, error)
List(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error)
Delete(ctx context.Context, resourceGroupName, diskname string) error
}
type disksClientImpl struct {
c *compute.DisksClient
}
var _ DisksClient = (*disksClientImpl)(nil)
func (c *disksClientImpl) CreateOrUpdate(ctx context.Context, resourceGroupName, diskName string, parameters compute.Disk) (*compute.Disk, error) {
future, err := c.c.BeginCreateOrUpdate(ctx, resourceGroupName, diskName, parameters, nil)
if err != nil {
return nil, fmt.Errorf("creating/updating disk: %w", err)
}
resp, err := future.PollUntilDone(ctx, nil)
if err != nil {
return nil, fmt.Errorf("waiting for disk create/update completion: %w", err)
}
return &resp.Disk, err
}
func (c *disksClientImpl) List(ctx context.Context, resourceGroupName string) ([]*compute.Disk, error) {
if resourceGroupName == "" {
return nil, nil
}
var l []*compute.Disk
pager := c.c.NewListByResourceGroupPager(resourceGroupName, nil)
for pager.More() {
resp, err := pager.NextPage(ctx)
if err != nil {View on GitHub (pinned to 4c8573c808)
Solutions
- Unwrap the error and inspect the *azcore.ResponseError StatusCode/ErrorCode to identify the actual ARM failure (401/403 auth, 404 resource group, 409 conflict/quota, 429 throttling).
- Verify the Azure identity has Microsoft.Compute/disks/write permission on the target resource group.
- Confirm resourceGroupName and subscriptionID match the cluster (cluster resource group vs node resource group).
- Validate the compute.Disk parameters (Location, SKU name, DiskSizeGB, Zone) against the target region's supported values.
- If throttled (429), retry with backoff; if auth failed, refresh credentials (az login / managed identity).
Example fix
var respErr *azcore.ResponseError
if errors.As(err, &respErr) {
klog.Infof("disk create failed: %s %d %s", respErr.ErrorCode, respErr.StatusCode, respErr.Error())
if respErr.StatusCode == 429 {
// retry after backoff
}
} Defensive patterns
Strategy: try-catch
Validate before calling
var respErr *azcore.ResponseError
if errors.As(err, &respErr) && respErr.StatusCode == 404 {
return nil, fmt.Errorf("resource group %q not found: check subscription/rg names", resourceGroupName)
} Type guard
func isAzureResponseError(err error) (*azcore.ResponseError, bool) {
var re *azcore.ResponseError
ok := errors.As(err, &re)
return re, ok
} Try / catch
if err != nil {
var respErr *azcore.ResponseError
switch {
case errors.As(err, &respErr) && respErr.StatusCode == 429:
// backoff and retry
case errors.As(err, &respErr) && (respErr.StatusCode == 401 || respErr.StatusCode == 403):
return fmt.Errorf("insufficient Azure permissions or bad credentials: %w", err)
default:
return fmt.Errorf("disk create/update failed: %w", err)
}
} Prevention
- Grant the cluster identity Microsoft.Compute/disks/write (Contributor on the node resource group).
- Validate compute.Disk parameters (SKU, size, zone, region support) before calling CreateOrUpdate.
- Use retry policies with backoff for 429s; check Azure quota in the target region ahead of time.
When it happens
Trigger: Calling DisksClient.CreateOrUpdate when the ARM API rejects the initial request: invalid compute.Disk parameters (bad SKU, invalid diskSizeGB), missing/insufficient RBAC (Microsoft.Compute/disks/write denied), nonexistent resource group, wrong subscription ID, expired or missing Azure credentials, or throttling (429) at request submission time.
Common situations: Deploying a cluster with a service principal whose scope does not cover the node resource group; typos in resourceGroupName; quota exceeded in the region; azidentity credentials not available (no managed identity / az login); SDK version mismatch producing an invalid parameters struct.
Related errors
- deleting disk: %w
- DNS not implemented on azureCloud
- cluster is not an Azure cluster
- waiting for disk create/update completion: %w
- listing disks: %w
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/32abcb272b467772.
Report an issue: GitHub.