kubernetes/kops · error
expecting exactly 1 address prefix for %q, found %d: %+v
Error message
expecting exactly 1 address prefix for %q, found %d: %+v
What it means
Validation guard in the Azure VNet Find: kOps models a VNet with exactly one address prefix, and the discovered network has a different count (zero or multiple prefixes). Fires when adopting a pre-existing VNet whose CIDR layout does not match kOps' single-CIDR assumption.
Source
Thrown at upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go:87
}
if found.ID == nil {
return nil, fmt.Errorf("found virtual network without ID")
}
if found.Properties == nil {
return nil, fmt.Errorf("found virtual network without properties")
}
if found.Properties.ProvisioningState != nil && *found.Properties.ProvisioningState == network.ProvisioningStateFailed {
klog.Warningf("found virtual network %q in failed provisioning state", *n.Name)
return nil, nil
}
if found.Properties.AddressSpace == nil {
return nil, fmt.Errorf("found virtual network without address space")
}
addrPrefixes := found.Properties.AddressSpace.AddressPrefixes
if len(addrPrefixes) != 1 {
return nil, fmt.Errorf("expecting exactly 1 address prefix for %q, found %d: %+v", *n.Name, len(addrPrefixes), addrPrefixes)
}
return &VirtualNetwork{
Name: n.Name,
Lifecycle: n.Lifecycle,
Shared: n.Shared,
ResourceGroup: &ResourceGroup{
Name: n.ResourceGroup.Name,
},
CIDR: addrPrefixes[0],
Tags: found.Tags,
}, nil
}
func (n *VirtualNetwork) Normalize(c *fi.CloudupContext) error {
c.T.Cloud.(azure.AzureCloud).AddClusterTags(n.Tags)
return nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Use a VNet with exactly one address prefix for the cluster
- Or let kOps create its own VNet instead of specifying an existing NetworkID
- Adjust the VNet address prefixes in Azure before importing
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/azuretasks/virtualnetwork.go:87 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/db519d39848c03b7.
Report an issue: GitHub.