{"record":{"id":"8fe78fd4ed264a35","repo":"kubernetes/kops","slug":"unexpected-amount-of-ipv6-prefixes-on-interface-q","errorCode":null,"errorMessage":"unexpected amount of ipv6 prefixes on interface %q: %v","messagePattern":"unexpected amount of ipv6 prefixes on interface %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/controllers/awsipam.go","lineNumber":141,"sourceCode":"\t\t\tFilters: []ec2types.Filter{\n\t\t\t\t{\n\t\t\t\t\tName: new(\"attachment.instance-id\"),\n\t\t\t\t\tValues: []string{\n\t\t\t\t\t\tinstanceID,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\n\t\tif len(eni.NetworkInterfaces) != 1 {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected number of network interfaces for instance %q: %v\", instanceID, len(eni.NetworkInterfaces))\n\t\t}\n\n\t\tif len(eni.NetworkInterfaces[0].Ipv6Prefixes) != 1 {\n\t\t\treturn ctrl.Result{}, fmt.Errorf(\"unexpected amount of ipv6 prefixes on interface %q: %v\", *eni.NetworkInterfaces[0].NetworkInterfaceId, len(eni.NetworkInterfaces[0].Ipv6Prefixes))\n\t\t}\n\n\t\tipv6Address := aws.ToString(eni.NetworkInterfaces[0].Ipv6Prefixes[0].Ipv6Prefix)\n\t\tpodCIDRs := []string{ipv6Address}\n\t\tif err := patchNodePodCIDRs(r.coreV1Client, ctx, node, podCIDRs); err != nil {\n\t\t\treturn ctrl.Result{}, err\n\t\t}\n\t}\n\n\treturn ctrl.Result{}, nil\n}\n\nfunc (r *AWSIPAMReconciler) SetupWithManager(mgr ctrl.Manager) error {\n\treturn ctrl.NewControllerManagedBy(mgr).\n\t\tNamed(\"aws_ipam\").\n\t\tFor(&corev1.Node{}).\n\t\tComplete(r)\n}","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/controllers/awsipam.go#L123-L159","documentation":"After finding the node's single ENI, the controller expects exactly one IPv6 prefix delegated to it, because it assigns that single /80 prefix as the node's podCIDR. This error is thrown when DescribeNetworkInterfaces reports a number of Ipv6Prefixes other than 1 on that interface.","triggerScenarios":"eni.NetworkInterfaces[0].Ipv6Prefixes has length 0 (the ENI was not allocated an IPv6 prefix yet, or IPv6 prefix delegation is disabled on the subnet/instance) or length > 1 (multiple /80 prefixes delegated, e.g. after kubelet/controller restarts or manual assignment), while patching expects exactly one.","commonSituations":"Cluster not fully configured for IPv6 prefix delegation (subnet without an IPv6 CIDR, 'assignIpv6AddressOnCreation' or prefix delegation not enabled); node launched before prefix assignment completed; manual EC2 changes adding or removing IPv6 prefixes; running an IPv4-only cluster while the IPv6 IPAM controller is enabled.","solutions":["Ensure the subnet and instance are configured for IPv6: subnet has an IPv6 CIDR and the ENI has an IPv6 prefix delegated (check in EC2 console / aws ec2 describe-network-instances --query ...Ipv6Prefixes).","Wait/requeue briefly — prefix delegation can lag instance launch; treat 0 prefixes as transient rather than fatal if the node is new.","Verify the cluster is actually running with the IPv6 pod-CIDR IPAM mode; this controller should only be enabled for kops IPv6 clusters.","If multiple prefixes are delegated intentionally, adjust the controller to pick the first prefix instead of erroring."],"exampleFix":"// before\nif len(eni.NetworkInterfaces[0].Ipv6Prefixes) != 1 {\n\treturn ctrl.Result{}, fmt.Errorf(\"unexpected amount of ipv6 prefixes on interface %q: %v\", *eni.NetworkInterfaces[0].NetworkInterfaceId, len(eni.NetworkInterfaces[0].Ipv6Prefixes))\n}\n// after\nprefixes := eni.NetworkInterfaces[0].Ipv6Prefixes\nif len(prefixes) == 0 {\n\tklog.Warningf(\"no ipv6 prefixes yet on interface %q; requeueing\", *eni.NetworkInterfaces[0].NetworkInterfaceId)\n\treturn ctrl.Result{RequeueAfter: 10 * time.Second}, nil\n}\nif len(prefixes) > 1 {\n\treturn ctrl.Result{}, fmt.Errorf(\"unexpected amount of ipv6 prefixes on interface %q: %v\", *eni.NetworkInterfaces[0].NetworkInterfaceId, len(prefixes))\n}","handlingStrategy":"retry","validationCode":"resp, _ := ec2Client.DescribeNetworkInterfaces(ctx, &ec2.DescribeNetworkInterfacesInput{Filters: eniFilters})\nif len(resp.NetworkInterfaces) == 1 && len(resp.NetworkInterfaces[0].Ipv6Prefixes) == 0 && recentlyLaunched(instance) {\n\t// prefix delegation not propagated yet — retry later instead of failing\n}","typeGuard":"func hasSingleIPv6Prefix(iface ec2types.NetworkInterface) bool {\n\treturn len(iface.Ipv6Prefixes) == 1 && iface.Ipv6Prefixes[0].Ipv6Prefix != nil\n}","tryCatchPattern":"result, err := r.Reconcile(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"ipv6 prefixes\") {\n\tklog.Warningf(\"ipv6 prefix count mismatch, requeueing with backoff: %v\", err)\n\treturn ctrl.Result{RequeueAfter: 30 * time.Second}, nil\n}","preventionTips":["Enable IPv6 prefix delegation on the subnet and instances (IPv6 CIDR on subnet, assign Ipv6Prefix on ENI) before enabling this controller.","Only run the AWS IPAM controller on clusters provisioned for kops IPv6 pod-CIDR mode.","Distinguish '0 prefixes' (transient — retry) from '>1 prefixes' (config drift — alert) in monitoring.","Do not manually add/remove IPv6 prefixes on node ENIs while the controller manages podCIDRs."],"tags":["aws","ec2","ipv6","prefix-delegation"],"backgroundTag":"missing-ipv6-prefix-delegation","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"}