kubernetes/kops · error
NatGateway %q has nil addresses
Error message
NatGateway %q has nil addresses
What it means
A NAT Gateway was found via the associated route table, but its NatGatewayAddresses field is nil — AWS returned no address list — leaving kOps unable to select an allocation ID for the ElasticIP task.
Source
Thrown at upup/pkg/fi/cloudup/awstasks/elastic_ip.go:91
// Find via RouteTable -> NatGateway -> ElasticIP
if allocationID == nil && publicIP == nil && e.AssociatedNatGatewayRouteTable != nil {
ngw, err := findNatGatewayFromRouteTable(ctx, cloud, e.AssociatedNatGatewayRouteTable)
if err != nil {
return nil, fmt.Errorf("error finding AssociatedNatGatewayRouteTable: %v", err)
}
if ngw == nil {
klog.V(2).Infof("AssociatedNatGatewayRouteTable not found")
} else {
if len(ngw.NatGatewayAddresses) == 0 {
return nil, fmt.Errorf("NatGateway %q has no addresses", *ngw.NatGatewayId)
}
if len(ngw.NatGatewayAddresses) > 1 {
return nil, fmt.Errorf("NatGateway %q has multiple addresses", *ngw.NatGatewayId)
}
allocationID = ngw.NatGatewayAddresses[0].AllocationId
if allocationID == nil {
return nil, fmt.Errorf("NatGateway %q has nil addresses", *ngw.NatGatewayId)
} else {
klog.V(2).Infof("Found ElasticIP AllocationID %q via NatGateway", *allocationID)
}
}
}
// Find via tag on subnet
// TODO: Deprecated, because doesn't round-trip with terraform
if allocationID == nil && publicIP == nil && e.TagOnSubnet != nil && e.TagOnSubnet.ID != nil {
var filters []ec2types.Filter
filters = append(filters, awsup.NewEC2Filter("key", "AssociatedElasticIp"))
filters = append(filters, awsup.NewEC2Filter("resource-id", *e.TagOnSubnet.ID))
request := &ec2.DescribeTagsInput{
Filters: filters,
}
response, err := cloud.EC2().DescribeTags(ctx, request)View on GitHub (pinned to 4c8573c808)
Solutions
- Re-run once the NAT Gateway fully reports its addresses
- Recreate the NAT Gateway if it never populates addresses
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/awstasks/elastic_ip.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/b896e915788e8780.
Report an issue: GitHub.