kubernetes/kops · error
unknown subnet type %q
Error message
unknown subnet type %q
What it means
Raised by buildPublicIPOpts in its default switch branch when the resolved subnetType is not one of the recognized kops subnet types (Public, Utility, Private). This means an unrecognized subnet type value reached the public-IP decision logic.
Source
Thrown at pkg/model/awsmodel/spotinst.go:761
subnetType = subnet.Type
}
var associatePublicIP bool
switch subnetType {
case kops.SubnetTypePublic, kops.SubnetTypeUtility:
associatePublicIP = true
if ig.Spec.AssociatePublicIP != nil {
associatePublicIP = *ig.Spec.AssociatePublicIP
}
case kops.SubnetTypeDualStack, kops.SubnetTypePrivate:
associatePublicIP = false
if ig.Spec.AssociatePublicIP != nil {
if *ig.Spec.AssociatePublicIP {
klog.Warningf("Ignoring AssociatePublicIPAddress=true for private SpotInstanceGroup %q", ig.ObjectMeta.Name)
}
}
default:
return nil, fmt.Errorf("unknown subnet type %q", subnetType)
}
return new(associatePublicIP), nil
}
func (b *SpotInstanceGroupModelBuilder) buildRootVolumeOpts(ig *kops.InstanceGroup) (*spotinsttasks.RootVolumeOpts, error) {
opts := new(spotinsttasks.RootVolumeOpts)
var size int32
var typ string
var iops int32
var throughput int32
if ig.Spec.RootVolume != nil {
// Optimization.
{
if fi.ValueOf(ig.Spec.RootVolume.Optimization) {
opts.Optimization = ig.Spec.RootVolume.Optimization
}View on GitHub (pinned to 4c8573c808)
Solutions
- Set subnetType to a valid value: Public, Private, or Utility
- Upgrade kops to the latest version if a newer subnet type is in use
- Validate the cluster YAML and re-run kops update --yes
Example fix
// before spec: subnetType: publik // after spec: subnetType: Public
Defensive patterns
Strategy: validation
Validate before calling
allowed := map[kops.SubnetType]bool{"Public": true, "Private": true, "Utility": true}
for _, s := range cluster.Spec.Subnets {
if !allowed[s.Type] {
return fmt.Errorf("subnet %q has unsupported type %q", s.Name, s.Type)
}
} Type guard
func isKnownSubnetType(t kops.SubnetType) bool {
switch t {
case "", "Public", "Private", "Utility":
return true
}
return false
} Prevention
- Only use documented subnetType values in cluster YAML
- Keep kops binary and cluster spec on compatible versions
- Lint cluster YAML before applying to the state store
When it happens
Trigger: kops create/update where the cluster's subnet spec carries an unknown/invalid subnetType value that the Spotinst model does not handle.
Common situations: Hand-edited cluster YAML with a typo in subnet type, a subnetType introduced in a newer kops version used by an older binary (or vice versa), or corrupt cluster state in the state store.
Related errors
- error building public ip options: %v
- error building subnets: %v
- could not determine any subnets for SpotInstanceGroup %q; su
- SpotInstanceGroup %q uses subnet %q that does not exist
- SpotInstanceGroup %q cannot be in subnets of different Type
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/b8991e8e83f33213.
Report an issue: GitHub.