kubernetes/kops · error
failed to parse loadbalancer ID %s
Error message
failed to parse loadbalancer ID %s
What it means
When a VMSS IP configuration lists load balancer backend address pools, Find() looks for pools whose ID contains "api" (the API load balancer kOps manages) and parses the pool's ARM ID with azure.ParseLoadBalancerID to recover the load balancer name and resource group. This error fires when that ID string is not a valid load balancer backend address pool resource ID.
Source
Thrown at upup/pkg/fi/cloudup/azuretasks/vmscaleset.go:162
return nil, fmt.Errorf("found VMSS without IP config subnet")
}
if ipConfig.Properties.Subnet.ID == nil {
return nil, fmt.Errorf("found VMSS without IP config subnet ID")
}
subnetID, err := azure.ParseSubnetID(*ipConfig.Properties.Subnet.ID)
if err != nil {
return nil, fmt.Errorf("failed to parse subnet ID %s", *ipConfig.Properties.Subnet.ID)
}
var loadBalancerID *azure.LoadBalancerID
if ipConfig.Properties.LoadBalancerBackendAddressPools != nil {
for _, i := range ipConfig.Properties.LoadBalancerBackendAddressPools {
if !strings.Contains(*i.ID, "api") {
continue
}
loadBalancerID, err = azure.ParseLoadBalancerID(*i.ID)
if err != nil {
return nil, fmt.Errorf("failed to parse loadbalancer ID %s", *i.ID)
}
}
}
osProfile := profile.OSProfile
if osProfile.LinuxConfiguration == nil {
return nil, fmt.Errorf("found VMSS without Linux config")
}
if osProfile.LinuxConfiguration.SSH == nil {
return nil, fmt.Errorf("found VMSS without SSH config")
}
if osProfile.LinuxConfiguration.SSH.PublicKeys == nil {
return nil, fmt.Errorf("found VMSS without SSH public keys")
}
sshKeys := osProfile.LinuxConfiguration.SSH.PublicKeys
if len(sshKeys) != 1 {
return nil, fmt.Errorf("expecting exactly 1 SSH key for %q, found %d: %+v", *s.Name, len(sshKeys), sshKeys)
}View on GitHub (pinned to 4c8573c808)
Solutions
- Print the pool IDs with `az vmss show ... --query "virtualMachineProfile.networkProfile.networkInterfaceConfigurations[0].ipConfigurations[0].loadBalancerBackendAddressPools"` and verify each is a canonical backendAddressPools ARM ID.
- Restore the load balancer backend pool reference to the kops-managed one by re-running `kops update cluster --yes` (or delete the foreign pool association).
- If a valid new ID format is rejected, update azure.ParseLoadBalancerID to handle it and add a regression test.
- Avoid manual edits to load balancers in kops-managed clusters.
Example fix
// before "/subscriptions/.../Microsoft.Network/loadBalancers/api/backendAddressPools" // after (full canonical form) "/subscriptions/<sub>/resourceGroups/<rg>/providers/Microsoft.Network/loadBalancers/<lb-name>/backendAddressPools/<pool-name>"
Defensive patterns
Strategy: validation
Validate before calling
re := regexp.MustCompile(`^/subscriptions/[^/]+/resourceGroups/[^/]+/providers/Microsoft\.Network/loadBalancers/[^/]+/backendAddressPools/[^/]+$`)
if !re.MatchString(poolID) { return fmt.Errorf("malformed backend pool ID: %s", poolID) } Try / catch
lbID, err := azure.ParseLoadBalancerID(id)
if err != nil {
return fmt.Errorf("kops: unusable load balancer pool ID %q: %w", id, err)
} Prevention
- Do not attach foreign load balancer pools to kops-managed VMSS
- Keep load balancer names matching kops conventions (api lb contains "api")
- Reconcile with kops update cluster before manual LB changes
- Test ParseLoadBalancerID against your environment's IDs
When it happens
Trigger: Find() on a VMSS whose ipConfigurations[].loadBalancerBackendAddressPools contains an entry containing "api" in its ID, but the ID fails azure.ParseLoadBalancerID (malformed path, missing segments, wrong provider).
Common situations: Load balancer pools attached by other tools or manual portal edits with non-standard IDs; kops-created cluster where the API load balancer was renamed/recreated externally; SDK/API version differences altering ID casing or shape.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- failed to parse subnet ID %s
- expected exactly one subnet for InstanceGroup %q; subnets wa
- unexpected subnet type: for InstanceGroup %q; type was %s
- instance group must have the same min and max size in Azure,
- malformed format of image urn: %s
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/89aafe510aafca02.
Report an issue: GitHub.