kubernetes/kops · error
could not find subnet %s from clusterSpec
Error message
could not find subnet %s from clusterSpec
What it means
While building OpenStack instances, a subnet referenced by name had no matching entry in cluster.spec.networking.subnets. The lookup iterates the cluster spec's subnets and falls through to this generic not-found guard, so the subnet name/ID at fault is one referenced by the instance group or network model but absent from the spec.
Source
Thrown at pkg/model/openstackmodel/context.go:91
func (c *OpenstackModelContext) APIResourceName() string {
if c.Cluster.Spec.API.PublicName != "" {
return c.Cluster.Spec.API.PublicName
}
return "api." + c.ClusterName()
}
func (c *OpenstackModelContext) findSubnetClusterSpec(subnet string) (string, kops.SubnetType, error) {
for _, sp := range c.Cluster.Spec.Networking.Subnets {
if sp.Name == subnet {
name, err := c.findSubnetNameByID(sp.ID, sp.Name)
if err != nil {
return "", "", err
}
return name, sp.Type, nil
}
}
return "", "", fmt.Errorf("could not find subnet %s from clusterSpec", subnet)
}
func (c *OpenstackModelContext) findSubnetNameByID(subnetID string, subnetName string) (string, error) {
if subnetID == "" {
return subnetName + "." + c.ClusterName(), nil
}
osCloud, err := c.createCloud()
if err != nil {
return "", err
}
subnet, err := osCloud.GetSubnet(subnetID)
if err != nil {
return "", err
}
return subnet.Name, nil
}View on GitHub (pinned to 4c8573c808)
Solutions
- Add the subnet to spec.networking.subnets in the cluster spec with its name and ID
- Check for typos or renaming between the instance group's subnet references and the spec
- Re-create the cluster spec if subnets were removed out-of-band
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/model/openstackmodel/context.go:91 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/1bd84ef26057666c.
Report an issue: GitHub.