kubernetes/kops · error
EgressOnlyInternetGateway, InternetGateway, Instance, NatGat
Error message
EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection is required
What it means
This error is raised in Route task CheckChanges when no route target is specified at all. An AWS route must point to exactly one target type (EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection); kOps rejects routes with zero targets before calling AWS.
Source
Thrown at upup/pkg/fi/cloudup/awstasks/route.go:168
}
}
if e.InternetGateway != nil {
targetCount++
}
if e.Instance != nil {
targetCount++
}
if e.NatGateway != nil {
targetCount++
}
if e.TransitGatewayID != nil {
targetCount++
}
if e.VPCPeeringConnectionID != nil {
targetCount++
}
if targetCount == 0 {
return fmt.Errorf("EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection is required")
}
if targetCount != 1 {
return fmt.Errorf("cannot set more than one EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGateway, or VpcPeeringConnection")
}
}
if a != nil {
if changes.RouteTable != nil {
return fi.CannotChangeField("RouteTable")
}
if changes.CIDR != nil {
return fi.CannotChangeField("CIDR")
}
if changes.IPv6CIDR != nil {
return fi.CannotChangeField("IPv6CIDR")
}
}
return nilView on GitHub (pinned to 4c8573c808)
Solutions
- Add the intended target (e.g. internetGateway: igw-123 or natGateway: nat-456) to the route
- Check the upstream data source that generated the route to ensure the target field is populated
- Validate the manifest with kops before applying
Example fix
// before route: cidr: 0.0.0.0/0 // after route: cidr: 0.0.0.0/0 internetGateway: igw-0abc123
Defensive patterns
Strategy: validation
Validate before calling
func hasRouteTarget(r Route) bool {
return r.EgressOnlyInternetGateway != nil || r.InternetGateway != nil ||
r.Instance != nil || r.NatGateway != nil ||
r.TransitGatewayID != nil || r.VPCPeeringConnectionID != nil
}
if !hasRouteTarget(route) { return errors.New("route requires exactly one target") } Prevention
- Never hand-write a Route entry without a target field
- Run kops update cluster with --dry-run to catch missing targets before apply
- Keep target fields populated by the same data source that sets the CIDR
When it happens
Trigger: Defining a Route task with a CIDR/IPv6CIDR destination but leaving all target fields (EgressOnlyInternetGateway, InternetGateway, Instance, NatGateway, TransitGatewayID, VPCPeeringConnectionID) nil.
Common situations: Hand-writing route entries in a cluster manifest and forgetting the target; a templating tool dropping a field; deleting the target stanza during refactor.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- missing target for route
- cannot set more than one CIDR or IPv6CIDR
- cannot set more than one EgressOnlyInternetGateway, Internet
- --region is required (when --external)
- instance id for cloud instance member cannot be empty
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/5d03a7d310ccc276.
Report an issue: GitHub.