{"record":{"id":"ee4778404dcb50fa","repo":"kubernetes/kops","slug":"unknown-load-balancer-type-q","errorCode":null,"errorMessage":"unknown load balancer Type: %q","messagePattern":"unknown load balancer Type: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/awsmodel/api_loadbalancer.go","lineNumber":228,"sourceCode":"\t\tif b.Cluster.UsesLoadBalancerForKopsController() {\n\t\t\tnlb.SetWaitForLoadBalancerReady(true)\n\t\t}\n\n\t\tif b.Cluster.UsesLoadBalancerForKopsController() {\n\t\t\tlbSpec.CrossZoneLoadBalancing = new(true)\n\t\t} else if lbSpec.CrossZoneLoadBalancing == nil {\n\t\t\tlbSpec.CrossZoneLoadBalancing = new(false)\n\t\t}\n\n\t\tnlb.CrossZoneLoadBalancing = lbSpec.CrossZoneLoadBalancing\n\n\t\tswitch lbSpec.Type {\n\t\tcase kops.LoadBalancerTypeInternal:\n\t\t\tnlb.Scheme = elbv2types.LoadBalancerSchemeEnumInternal\n\t\tcase kops.LoadBalancerTypePublic:\n\t\t\tnlb.Scheme = elbv2types.LoadBalancerSchemeEnumInternetFacing\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown load balancer Type: %q\", lbSpec.Type)\n\t\t}\n\n\t\tif lbSpec.AccessLog != nil {\n\t\t\tnlb.AccessLog = &awstasks.NetworkLoadBalancerAccessLog{\n\t\t\t\tEnabled:        new(true),\n\t\t\t\tS3BucketName:   lbSpec.AccessLog.Bucket,\n\t\t\t\tS3BucketPrefix: lbSpec.AccessLog.BucketPrefix,\n\t\t\t}\n\t\t} else {\n\t\t\tnlb.AccessLog = &awstasks.NetworkLoadBalancerAccessLog{\n\t\t\t\tEnabled: new(false),\n\t\t\t}\n\t\t}\n\n\t\t{\n\t\t\tgroupAttrs := map[string]string{\n\t\t\t\tawstasks.TargetGroupAttributeDeregistrationDelayConnectionTerminationEnabled: \"true\",\n\t\t\t\tawstasks.TargetGroupAttributeDeregistrationDelayTimeoutSeconds:               \"30\",","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/awsmodel/api_loadbalancer.go#L210-L246","documentation":"During AWS model building, kOps maps the cluster spec's api.loadBalancer.type to an ELBv2 scheme. Only the enum values 'Internal' and 'Public' are accepted; anything else makes BuildNodePortTask/Build fail with this error rather than guessing a scheme.","triggerScenarios":"`kops update cluster` (or `kops create cluster --api-loadbalancer-type=...`) with spec.api.loadBalancer.type set to a value other than \"internal\" or \"public\" (empty string, typo like \"internall\"/\"external\", or wrong casing, since the switch is case-sensitive).","commonSituations":"Hand-edited cluster.yaml with a misspelled or capitalized type; copying config from a classic-ELB-era docs page; tooling that serializes the field as \"\" when unset; migrating configs where the field was removed/renamed.","solutions":["Set spec.api.loadBalancer.type in the cluster spec to exactly \"public\" or \"internal\" (kops accepts only these kops.LoadBalancerType values, lowercase).","If the field is empty in cluster.yaml, run `kops edit cluster` and add the type explicitly, e.g. `type: Public`.","Check for casing/typo with `kops get cluster -oyaml | grep -A3 loadBalancer` and fix to lowercase internal/public.","Upgrade kOps if a previously valid value stopped working; older/newer schemas may differ — validate with `kops toolbox template` or `kops replace -f` to surface schema errors early."],"exampleFix":"// before (cluster.yaml)\napi:\n  loadBalancer:\n    type: External\n// after\napi:\n  loadBalancer:\n    type: Public","handlingStrategy":"validation","validationCode":"# validate cluster spec before kops update\ntype=$(kops get cluster -oyaml | awk '/^[ ]*type:/{print $2}')\ncase \"$type\" in\n  Public|public|Internal|internal) echo \"ok\";;\n  *) echo \"invalid loadBalancer type: '$type' (must be public or internal)\"; exit 1;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set spec.api.loadBalancer.type to the documented values \"Public\" or \"Internal\"","Never hand-edit casing; keep cluster.yaml lowercase per kops schema","Run `kops validate cluster` / dry-run `kops update cluster --target=terraform` after editing the LB spec","Pin config templates to the kOps version in use so removed/renamed fields are caught"],"tags":["aws","load-balancer","configuration","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}