Repository: kubernetes/kubernetes (language: go)

Issue:
During the deployment of Kubernetes 1.31.0 and MultiCIDRServiceAllocator was enabled, which then led to a failure when creating a service.
### What happened?

When deploying Kubernetes 1.31.0 with MultiCIDRServiceAllocator enabled, an error occurs when trying to create a service in the cluster with the following error message:

```bash
root@controller-node-1:~# kubectl apply -f test-service.yaml
Error from server (InternalError): error when creating "test-service.yaml": Internal error occurred: failed to allocate a serviceIP: range is full
```

Am I missing some necessary configuration? Can you help me take a look?  Thanks.

### What did you expect to happen?

Can successfully create a service

### How can we reproduce it (as minimally and precisely as possible)?

1. Deploy k8s and enable the featureGate MultiCIDRServiceAllocator function
2. Then create a service and enable IPv6
3. The service yaml information for the test is as follows:

```yaml
apiVersion: v1
kind: Service
metadata:
  name: dual-stack-service
  namespace: default
spec:
  ipFamilyPolicy: RequireDualStack
  ipFamilies:
    - IPv4
    - IPv6
  selector:
    app: my-app
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80
  type: ClusterIP
```

4. Disable MultiCIDRServiceAllocator feature, create with same service yaml, everything works fine.

```bash
kubectl apply -f test.yaml             
service/dual-stack-service created
```

### Anything else we need to know?

Check kube-apiserver and you will see the following error

```
1ms" userAgent="kube-apiserver/v1.31.0 (linux/amd64) kubernetes/9edcffc" audit-ID="39ca3505-f77b-42fe-b935-2585dc25506b" srcIP="[::1]:50666" apf_pl="exempt" apf_fs="exempt" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="2.340321ms" resp=201
I0923 11:07:57.150953       1 httplog.go:134] "HTTP" verb="POST" URI="/api/v1/namespaces/default/services?fieldManager=kubectl-client-side-apply&fieldValidation=Strict" latency="15.907975ms" userAgent="kubectl/v1.28.0 (linux/amd64) kubernetes/855e7c4" audit-ID="d27bf18c-7022-4f9f-bb2d-c63dabd64420" srcIP="172.18.0.1:60442" apf_pl="global-default" apf_fs="global-default" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="15.293168ms" resp=500 statusStack=<

        goroutine 23448 [running]:
        k8s.io/apiserver/pkg/server/httplog.(*respLogger).recordStatus(0xc007415760, 0xc00d878d48?)
                k8s.io/apiserver/pkg/server/httplog/httplog.go:336 +0xfa
        k8s.io/apiserver/pkg/server/httplog.(*respLogger).WriteHeader(0xc007415760, 0x1f4)
                k8s.io/apiserver/pkg/server/httplog/httplog.go:316 +0x1d
        k8s.io/apiserver/pkg/server/filters.(*baseTimeoutWriter).WriteHeader(0xc00d99c330, 0x1f4)
                k8s.io/apiserver/pkg/server/filters/timeout.go:237 +0x1cc
        k8s.io/apiserver/pkg/endpoints/metrics.(*ResponseWriterDelegator).WriteHeader(0x2f5da40?, 0xc00d878c60?)
                k8s.io/apiserver/pkg/endpoints/metrics/metrics.go:810 +0x26
        k8s.io/apiserver/pkg/endpoints/handlers/responsewriters.(*deferredResponseWriter).Write(0xc00d7cf7a0, {0xc00cad0000, 0x10f, 0x8000})
                k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go:243 +0x67b
        encoding/json.(*Encoder).Encode(0xc00d9cdf28, {0x351bbe0, 0xc00d79eaa0})
                encoding/json/stream.go:230 +0x1f8
        k8s.io/apimachinery/pkg/runtime/serializer/json.(*Serializer).doEncode(0x5a0fd80?, {0x3c4c068?, 0xc00d79eaa0?}, {0x3c42480, 0xc00d7cf7a0})
                k8s.io/apimachinery/pkg/runtime/serializer/json/json.go:246 +0x175
        k8s.io/apimachinery/pkg/runtime/serializer/json.(*Serializer).Encode(0xc0004e4000, {0x3c4c068?, 0xc00d79eaa0}, {0x3c42480, 0xc00d7cf7a0})
                k8s.io/apimachinery/pkg/runtime/serializer/json/json.go:220 +0xd2
        k8s.io/apimachinery/pkg/runtime/serializer/versioning.(*codec).doEncode(0xc00d79eb40, {0x3c4c068, 0xc00d79eaa0}, {0x3c42480, 0xc00d7cf7a0}, {0x0?, 0x0?})
                k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go:268 +0x51e
        k8s.io/apimachinery/pkg/runtime/serializer/versioning.(*codec).encode(0xc00d79eb40, {0x3c4c068?, 0xc00d79eaa0}, {0x3c42480, 0xc00d7cf7a0}, {0x0, 0x0})
                k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go:214 +0x119
        k8s.io/apimachinery/pkg/runtime/serializer/versioning.(*codec).Encode(0x3c76580?, {0x3c4c068?, 0xc00d79eaa0?}, {0x3c42480?, 0xc00d7cf7a0?})
                k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go:207 +0x2d
        k8s.io/apiserver/pkg/endpoints/handlers/responsewriters.SerializeObject({0x35d70a1, 0x10}, {0x7fb72cce3158, 0xc00d79eb40}, {0x3c6cbf0, 0xc00d486880}, 0xc005fa3b00, 0x1f4, {0x3c4c068, 0xc00d79eaa0})
                k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go:111 +0xa15
        k8s.io/apiserver/pkg/endpoints/handlers/responsewriters.WriteObjectNegotiated.func2()
                k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go:292 +0x1fd
        k8s.io/apiserver/pkg/endpoints/request.(*durationTracker).Track(0xc00d99c120, 0xc00d407ad0)
                k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go:75 +0x88
        k8s.io/apiserver/pkg/endpoints/request.TrackSerializeResponseObjectLatency({0x3c76580?, 0xc00d99c510?}, 0xc00d407ad0)
                k8s.io/apiserver/pkg/endpoints/request/webhook_duration.go:229 +0x5d
        k8s.io/apiserver/pkg/endpoints/handlers/responsewriters.WriteObjectNegotiated({0x3c60e40, 0xc000af5800}, {0x3c61020, 0x5ac8540}, {{0x0, 0x0}, {0x35c0bb0, 0x2}}, {0x3c6cbf0, 0xc00d486880}, ...)
                k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go:288 +0x772
        k8s.io/apiserver/pkg/endpoints/handlers/responsewriters.ErrorNegotiated({0x3c3ede0?, 0xc00d79ea00?}, {0x3c60e40, 0xc000af5800}, {{0x0?, 0xc00d9cf0e8?}, {0x35c0bb0?, 0xc00d87e360?}}, {0x3c6cbf0, 0xc00d486880}, ...)
                k8s.io/apiserver/pkg/endpoints/handlers/responsewriters/writers.go:329 +0x271
        k8s.io/apiserver/pkg/endpoints/handlers.(*RequestScope).err(0xc00d9941e0?, {0x3c3ede0?, 0xc00d79ea00?}, {0x3c6cbf0?, 0xc00d486880?}, 0x2?)
                k8s.io/apiserver/pkg/endpoints/handlers/rest.go:113 +0x9f
        k8s.io/apiserver/pkg/endpoints/handlers.CreateResource.createHandler.func1({0x3c6cbf0, 0xc00d486880}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/handlers/create.go:221 +0x1a7c
        k8s.io/apiserver/pkg/endpoints.(*APIInstaller).registerResourceHandlers.restfulCreateResource.func16(0xc00d486860, 0xc003368b60)
                k8s.io/apiserver/pkg/endpoints/installer.go:1282 +0x5c
        k8s.io/apiserver/pkg/endpoints.(*APIInstaller).registerResourceHandlers.InstrumentRouteFunc.func17(0xc00d486860, 0xc003368b60)
                k8s.io/apiserver/pkg/endpoints/metrics/metrics.go:600 +0x1ce
        github.com/emicklei/go-restful/v3.(*Container).dispatch(0xc001692d80, {0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                github.com/emicklei/go-restful/v3@v3.11.0/container.go:299 +0x9f0
        github.com/emicklei/go-restful/v3.(*Container).Dispatch(...)
                github.com/emicklei/go-restful/v3@v3.11.0/container.go:204
        k8s.io/apiserver/pkg/server.director.ServeHTTP({{0x35d2672?, 0xc00d9a6098?}, 0xc001692d80?, 0xc00038d730?}, {0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/server/handler.go:146 +0x56c
        k8s.io/kube-aggregator/pkg/apiserver.(*proxyHandler).ServeHTTP(0xc001b7c768?, {0x3c6cbf0?, 0xc00d486460?}, 0x23?)
                k8s.io/kube-aggregator/pkg/apiserver/handler_proxy.go:118 +0x25d
        k8s.io/apiserver/pkg/server/mux.(*pathHandler).ServeHTTP(0xc00775f900, {0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/server/mux/pathrecorder.go:251 +0x410
        k8s.io/apiserver/pkg/server/mux.(*PathRecorderMux).ServeHTTP(0xc008b669a0?, {0x3c6cbf0?, 0xc00d486460?}, 0xc00d9a63f0?)
                k8s.io/apiserver/pkg/server/mux/pathrecorder.go:237 +0x66
        k8s.io/apiserver/pkg/server.director.ServeHTTP({{0x35d4a43?, 0xc00d9a64e8?}, 0xc002355050?, 0xc0040e1ab0?}, {0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/server/handler.go:154 +0x6f1
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.TrackCompleted.trackCompleted.func22({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:110 +0x177
        net/http.HandlerFunc.ServeHTTP(0x3c76580?, {0x3c6cbf0?, 0xc00d486460?}, 0x4?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filters.withAuthorization.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filters/authorization.go:83 +0x626
        net/http.HandlerFunc.ServeHTTP(0xc00d9a68a0?, {0x3c6cbf0?, 0xc00d486460?}, 0xc0005dc000?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:84 +0x192
        net/http.HandlerFunc.ServeHTTP(0x1d175ef?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c2c868?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.TrackCompleted.trackCompleted.func23({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:110 +0x177
        net/http.HandlerFunc.ServeHTTP(0xc00d3756c0?, {0x3c6cbf0?, 0xc00d486460?}, 0x1e13816?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server/filters.(*priorityAndFairnessHandler).Handle.func9()
                k8s.io/apiserver/pkg/server/filters/priority-and-fairness.go:292 +0xd9
        k8s.io/apiserver/pkg/util/flowcontrol.(*configController).Handle.func2()
                k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go:192 +0x257
        k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset.(*request).Finish.func1(0xc00d85c2d0?, 0x70?, 0x34460e0?)
                k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go:391 +0x56
        k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset.(*request).Finish(0xc00d85c2d0, 0xc003368af0)
                k8s.io/apiserver/pkg/util/flowcontrol/fairqueuing/queueset/queueset.go:392 +0x39
        k8s.io/apiserver/pkg/util/flowcontrol.(*configController).Handle(0xc0004cec80, {0x3c76628, 0xc003368770}, {0xc00d6b32b0, {0x3c76428, 0xc00d375640}}, 0x0?, 0x0?, 0xc00d375680?, 0xc00d375680)
                k8s.io/apiserver/pkg/util/flowcontrol/apf_filter.go:179 +0x74b
        k8s.io/apiserver/pkg/server/filters.(*priorityAndFairnessHandler).Handle.func10(0xc0030915e0, {0x3c76580?, 0xc00d99c510?}, {0xc00d6b32b0?, {0x3c76428?, 0xc00d375640?}}, 0xc00d486540, 0xc00d99c540, 0xc00c4501e0, 0xc00d375680)
                k8s.io/apiserver/pkg/server/filters/priority-and-fairness.go:298 +0xeb
        k8s.io/apiserver/pkg/server/filters.(*priorityAndFairnessHandler).Handle(0xc0030915e0, {0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/server/filters/priority-and-fairness.go:299 +0xb25
        net/http.HandlerFunc.ServeHTTP(0xc00d567068?, {0x3c6cbf0?, 0xc00d486460?}, 0xc0005dc000?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:84 +0x192
        net/http.HandlerFunc.ServeHTTP(0x1d175ef?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c2c868?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.TrackCompleted.trackCompleted.func24({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:110 +0x177
        net/http.HandlerFunc.ServeHTTP(0xc00d99c360?, {0x3c6cbf0?, 0xc00d486460?}, 0xa683a2b45f389d52?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.WithImpersonation.func4({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filters/impersonation.go:50 +0x1b0
        net/http.HandlerFunc.ServeHTTP(0xc00d5677f0?, {0x3c6cbf0?, 0xc00d486460?}, 0xc0005dc000?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:84 +0x192
        net/http.HandlerFunc.ServeHTTP(0x1d175ef?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c2c868?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.TrackCompleted.trackCompleted.func25({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:110 +0x177
        net/http.HandlerFunc.ServeHTTP(0xc00d567a10?, {0x3c6cbf0?, 0xc00d486460?}, 0xc0005dc000?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:84 +0x192
        net/http.HandlerFunc.ServeHTTP(0x1d175ef?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c2c868?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.TrackCompleted.trackCompleted.func27({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:110 +0x177
        net/http.HandlerFunc.ServeHTTP(0x3c76580?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c26438?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filters.withAuthentication.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa3b00)
                k8s.io/apiserver/pkg/endpoints/filters/authentication.go:120 +0x79f
        net/http.HandlerFunc.ServeHTTP(0x3c76580?, {0x3c6cbf0?, 0xc00d486460?}, 0x3c2c868?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/endpoints/filterlatency.trackStarted.func1({0x3c6cbf0, 0xc00d486460}, 0xc005fa37a0)
                k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency.go:94 +0x354
        net/http.HandlerFunc.ServeHTTP(0xc005fa3560?, {0x3c6cbf0?, 0xc00d486460?}, 0xc00d848a50?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server.DefaultBuildHandlerChain.WithWarningRecorder.func11({0x3c6cbf0, 0xc00d486460}, 0xc005fa3560)
                k8s.io/apiserver/pkg/endpoints/filters/warning.go:35 +0xb9
        net/http.HandlerFunc.ServeHTTP(0xc00955dfd0?, {0x3c6cbf0?, 0xc00d486460?}, 0xc00955dfd0?)
                net/http/server.go:2171 +0x29
        k8s.io/apiserver/pkg/server/filters.(*timeoutHandler).ServeHTTP.func1()
                k8s.io/apiserver/pkg/server/filters/timeout.go:115 +0x62
        created by k8s.io/apiserver/pkg/server/filters.(*timeoutHandler).ServeHTTP in goroutine 23431
                k8s.io/apiserver/pkg/server/filters/timeout.go:101 +0x198
 > addedInfo=<
        logging error output: "{\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"Internal error occurred: failed to allocate a serviceIP: range is full\",\"reason\":\"InternalError\",\"details\":{\"causes\":[{\"message\":\"failed to allocate a serviceIP: range is full\"}]},\"code\":500}\n"
 >
I0923 11:07:57.151260       1 cidrallocator.go:277] updated ClusterIP allocator for Service CIDR fd00:10:233::/116
I0923 11:07:57.151274       1 cidrallocator.go:243] syncing ServiceCIDR allocators took: 4.363189ms
I0923 11:07:57.152400       1 httplog.go:134] "HTTP" verb="APPLY" URI="/apis/networking.k8s.io/v1beta1/servicecidrs/kubernetes/status?fieldManager=service-cidr-controller&force=true" latency="3.55043ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/system:serviceaccount:kube-system:service-cidrs-controller" audit-ID="8ffd052f-41b7-4402-8e1d-bf7c1f922188" srcIP="172.18.0.3:44714" apf_pl="workload-high" apf_fs="kube-system-service-accounts" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="3.080476ms" resp=200
I0923 11:07:57.158493       1 httplog.go:134] "HTTP" verb="GET" URI="/api" latency="1.345547ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/system:serviceaccount:kube-system:resourcequota-controller" audit-ID="6d69ba6e-d78e-4e0f-a150-123321e861f4" srcIP="172.18.0.3:44714" apf_pl="workload-high" apf_fs="kube-system-service-accounts" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="609.308µs" resp=200
I0923 11:07:57.160655       1 httplog.go:134] "HTTP" verb="GET" URI="/apis" latency="1.158272ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/system:serviceaccount:kube-system:resourcequota-controller" audit-ID="333368b2-f5d3-4323-ae03-477ba58da367" srcIP="172.18.0.3:44714" apf_pl="workload-high" apf_fs="kube-system-service-accounts" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="767.455µs" resp=200
I0923 11:07:57.642880       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-controller-manager?timeout=5s" latency="5.535226ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="6f6a58be-3d80-4437-abde-a1da9fcd3aa5" srcIP="172.18.0.3:33630" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="5.081188ms" resp=200
I0923 11:07:57.811806       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="502.755µs" userAgent="kube-probe/1.31" audit-ID="cea8cbae-ed22-49c3-a072-03ab6daaa5bb" srcIP="172.18.0.3:34026" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="265.857µs" resp=200
I0923 11:07:57.820286       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/apiserver-mhpdv4nvr63tysjgwwxs5rrdle" latency="4.567151ms" userAgent="kube-apiserver/v1.31.0 (linux/amd64) kubernetes/9edcffc" audit-ID="00212d5f-1b2e-4244-8c8b-0d90b11bad2a" srcIP="[::1]:50666" apf_pl="exempt" apf_fs="exempt" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="4.239606ms" resp=200
I0923 11:07:57.876446       1 httplog.go:134] "HTTP" verb="GET" URI="/api" latency="1.534883ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/system:serviceaccount:kube-system:generic-garbage-collector" audit-ID="10d2876d-1c4e-4bad-b7f5-b16cb5e35847" srcIP="172.18.0.3:44714" apf_pl="workload-high" apf_fs="kube-system-service-accounts" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="646.149µs" resp=200
I0923 11:07:57.879639       1 httplog.go:134] "HTTP" verb="GET" URI="/apis" latency="1.281986ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/system:serviceaccount:kube-system:generic-garbage-collector" audit-ID="b9da6911-6445-4bef-8bbe-03faaca5333f" srcIP="172.18.0.3:44714" apf_pl="workload-high" apf_fs="kube-system-service-accounts" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="851.935µs" resp=200
I0923 11:07:58.669695       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-scheduler?timeout=5s" latency="5.4473ms" userAgent="kube-scheduler/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="3a063464-e136-4ed6-a6e8-d35438ab1519" srcIP="172.18.0.3:33668" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="4.909292ms" resp=200
I0923 11:07:58.813809       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="3.215281ms" userAgent="kube-probe/1.31" audit-ID="e18e3623-98c7-42b1-9bb0-0d3cbc5cf10d" srcIP="172.18.0.3:34042" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="2.908629ms" resp=200
I0923 11:07:58.843866       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/test-worker?timeout=10s" latency="3.545531ms" userAgent="kubelet/v1.31.0 (linux/amd64) kubernetes/9edcffc" audit-ID="4dc6e3d0-0129-4984-add2-5b90782acdab" srcIP="172.18.0.2:47072" apf_pl="node-high" apf_fs="system-node-high" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="3.066497ms" resp=200
I0923 11:07:59.649276       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-controller-manager?timeout=5s" latency="4.195773ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="926e2e36-d223-438e-806e-b95e5aade245" srcIP="172.18.0.3:33630" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="3.599817ms" resp=200
I0923 11:07:59.814701       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="3.535573ms" userAgent="kube-probe/1.31" audit-ID="cf5b3bcc-bb26-4fa7-9d61-a1cd2028b859" srcIP="172.18.0.3:34050" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="3.275286ms" resp=200
I0923 11:08:00.280649       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-node-lease/leases/test-control-plane?timeout=10s" latency="5.420941ms" userAgent="kubelet/v1.31.0 (linux/amd64) kubernetes/9edcffc" audit-ID="605f7302-07fe-4d7f-a346-66cae51038eb" srcIP="172.18.0.3:33640" apf_pl="node-high" apf_fs="system-node-high" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="4.715523ms" resp=200
I0923 11:08:00.682007       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-scheduler?timeout=5s" latency="9.963364ms" userAgent="kube-scheduler/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="a86f1452-075c-4a38-ad61-fe3fe3fd5301" srcIP="172.18.0.3:33668" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="9.517368ms" resp=200
I0923 11:08:00.814357       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="2.975113ms" userAgent="kube-probe/1.31" audit-ID="45f6a1cb-bbc5-439a-9ff2-8ae247d5e52a" srcIP="172.18.0.3:34062" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="2.408675ms" resp=200
I0923 11:08:01.655910       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-controller-manager?timeout=5s" latency="5.136937ms" userAgent="kube-controller-manager/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="dce89952-3d3d-46df-8d95-612fcd461d4b" srcIP="172.18.0.3:33630" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="4.497896ms" resp=200
I0923 11:08:01.811610       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="487.758µs" userAgent="kube-probe/1.31" audit-ID="3b7c1ef9-01fb-4087-a5d4-1093bddc9496" srcIP="172.18.0.3:58988" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="244.496µs" resp=200
I0923 11:08:02.689183       1 httplog.go:134] "HTTP" verb="PUT" URI="/apis/coordination.k8s.io/v1/namespaces/kube-system/leases/kube-scheduler?timeout=5s" latency="4.023116ms" userAgent="kube-scheduler/v1.31.0 (linux/amd64) kubernetes/9edcffc/leader-election" audit-ID="5502e546-bd18-44c3-b6e9-2e0ee7d2f742" srcIP="172.18.0.3:33668" apf_pl="leader-election" apf_fs="system-leader-election" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="3.524193ms" resp=200
I0923 11:08:02.812357       1 httplog.go:134] "HTTP" verb="GET" URI="/livez" latency="1.741594ms" userAgent="kube-probe/1.31" audit-ID="f63e072e-8453-4fe3-9476-13edcaac99bc" srcIP="172.18.0.3:59002" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="1.468739ms" resp=200
I0923 11:08:02.813133       1 httplog.go:134] "HTTP" verb="GET" URI="/readyz" latency="1.673271ms" userAgent="kube-probe/1.31" audit-ID="b6546ec4-c30b-426f-8691-8e1324fa3426" srcIP="172.18.0.3:59004" apf_pl="exempt" apf_fs="probes" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="1.450684ms" resp=200
E0923 11:08:03.000230       1 repairip.go:500] "Unhandled Error" err="IPAddress fd00:10:233::1cd appears to have leaked: cleaning up" logger="UnhandledError"
E0923 11:08:03.000275       1 repairip.go:500] "Unhandled Error" err="IPAddress 10.233.51.219 appears to have leaked: cleaning up" logger="UnhandledError"
I0923 11:08:03.004206       1 httplog.go:134] "HTTP" verb="POST" URI="/apis/events.k8s.io/v1/namespaces/default/events" latency="1.554619ms" userAgent="kube-apiserver/v1.31.0 (linux/amd64) kubernetes/9edcffc" audit-ID="3fa3d537-3563-44c7-9707-b11662836a95" srcIP="[::1]:50666" apf_pl="exempt" apf_fs="exempt" apf_iseats=1 apf_fseats=0 apf_additionalLatency="0s" apf_execution_time="1.311628ms" resp=422
E0923 11:08:03.005578       1 event_broadcaster.go:270] "Server rejected event (will not retry!)" err="Event \"fd00:10:233::1cd.17f7daea8a8debae\" is invalid: metadata.name: Invalid value: \"fd00:10:233::1cd.17f7daea8a8debae\": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')" event="&Event{ObjectMeta:{fd00:10:233::1cd.17f7daea8a8debae  default    0 0001-01-01 00:00:00 +0000 UTC <nil> <nil> map[] map[] [] [] []},EventTime:2024-09-23 11:08:03.001562851 +0000 UTC m=+119.806647154,Series:nil,ReportingController:ipallocator-repair-controller,ReportingInstance:ipallocator-repair-controller-test-control-plane,Action:IPAddressAllocation,Reason:IPAddressNotAllocated,Regarding:{IPAddress  fd00:10:233::1cd 793dd423-d268-4d5d-afb8-754199a96b05 networking.k8s.io/v1beta1 158844 },Related:nil,Note:IPAddress: fd00:10:233::1cd for Service default/dual-stack-service appears to have leaked: cleaning up,Type:Warning,DeprecatedSource:{ },DeprecatedFirstTimestamp:0001-01-01 00:00:00 +0000 UTC,DeprecatedLastTimestamp:0001-01-01 00:00:00 +0000 UTC,DeprecatedCount:0,}"
```

### Kubernetes version

<details>

```console
$ kubectl version
root@controller-node-1:~# kubectl version
Client Version: v1.31.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.31.0
```

</details>


### Cloud provider

<details>

</details>


### OS version

<details>

```console
# On Linux:
$ cat /etc/os-release
# paste output here
$ uname -a
# paste output here

# On Windows:
C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture
# paste output here
```

</details>


### Install tools

[kind](https://kind.sigs.k8s.io/)
<details>
root@controller-node-1:~# kind --version

kind version 0.24.0
</details>

K8S Version 1.31.0 deployed through the [kind](https://kind.sigs.k8s.io/) cluster, kind yaml is as follows

```
kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: kind
networking:
  serviceSubnet: "10.233.0.0/18,fd00:10:233::/116"
  podSubnet: "10.233.64.0/18,fd00:10:233:64::/64"
  ipFamily: dual
  disableDefaultCNI: true
  kubeProxyMode: iptables
  apiServerAddress: 127.0.0.1
kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    metadata:
      name: config
    apiServer:
        extraArgs:
          enable-admission-plugins: NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook
          default-not-ready-toleration-seconds: "10"
          default-unreachable-toleration-seconds: "10"
nodes:
  - role: control-plane
  - role: worker
runtimeConfig: 
   api/beta: "true"
featureGates: 
   "MultiCIDRServiceAllocator": true
```

### Container runtime (CRI) and version (if applicable)

<details>

</details>


### Related plugins (CNI, CSI, ...) and versions (if applicable)

<details>

</details>



Discussion / hints:
This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the `triage/accepted` label and provide further guidance.

The `triage/accepted` label can be added by org members by writing `/triage accepted` in a comment.


<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
</details>
Hey @ty-dc 
Seems like it is related to the provided 
 `--service-cluster-ip-range` which can be configured 
check [this](https://github.com/kubernetes-sigs/kwok/issues/818#issuecomment-2339470428) issue first. 
Also go through this document https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/#api

Please note that `MultiCIDRServiceAllocator` allocates IP as per the given range in `--service-cluster-ip-range`
> https://kubernetes.io/docs/tasks/network/extend-service-ip-ranges/#api

Thank you for your reply.  After referring to the document, the cluster servicecidr information is as follows:
```
root@controller-node-1:~# kubectl get servicecidr
NAME CIDRS AGE
kubernetes 10.233.0.0/18,fd00:10:233::/116 2d6h

root@controller-node-1:~# kubectl get service kubernetes
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.233.0.1 <none> 443/TCP 2d6h

root@controller-node-1:~# kubectl get ipaddress 10.233.0.1
NAME PARENTREF
10.233.0.1 services/default/kubernetes

root@controller-node-1:~# kubectl get servicecidr -oyaml
apiVersion: v1
items:
- apiVersion: networking.k8s.io/v1beta1
  kind: ServiceCIDR
  metadata:
    creationTimestamp: "2024-09-22T03:57:22Z"
    finalizers:
    - networking.k8s.io/service-cidr-finalizer
    name: kubernetes
    resourceVersion: "275310"
    uid: 352a487d-75ff-47d0-b3b2-01bad8ad4713
  spec:
    cidrs:
    - 10.233.0.0/18
    - fd00:10:233::/116
  status:
    conditions:
    - lastTransitionTime: "2024-09-24T10:01:18Z"
      message: Kubernetes Service CIDR is ready
      reason: ""
      status: "True"
      type: Ready
kind: List
metadata:
  resourceVersion: ""
```

can create a service in a cluster using the following command.

```
root@controller-node-1:~# for i in $(seq 1 13); do kubectl create service clusterip "test-$i" --tcp 80 -o json | jq -r .spec.clusterIP; done
10.233.30.237
10.233.41.17
10.233.46.28
10.233.54.193
10.233.59.23
10.233.48.26
10.233.10.15
10.233.5.77
10.233.33.230
10.233.40.90
10.233.45.220
10.233.45.158
10.233.3.204
```

Also the problem only occurs when creating a service with `ipFamilies: IPv6`.

/sig network
/assign
> Also the problem only occurs when creating a service with `ipFamilies: IPv6`.

yeah, the problem seems to be with the secondary allocator, I can repro with your description
@ty-dc found the problem, I will send a fix, in the meantime you can solve it by setting the feature gate `DisableAllocatorDualWrite`  to `true`?

```
kind.yaml
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: kind
networking:
  serviceSubnet: "10.233.0.0/18,fd00:10:233::/116"
  podSubnet: "10.233.64.0/18,fd00:10:233:64::/64"
  ipFamily: dual
  disableDefaultCNI: true
  kubeProxyMode: iptables
  apiServerAddress: 127.0.0.1
kubeadmConfigPatches:
  - |
    kind: ClusterConfiguration
    metadata:
      name: config
    apiServer:
        extraArgs:
          enable-admission-plugins: NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook
          default-not-ready-toleration-seconds: "10"
          default-unreachable-toleration-seconds: "10"
nodes:
  - role: control-plane
  - role: worker
runtimeConfig: 
   api/beta: "true"
featureGates: 
   "MultiCIDRServiceAllocator": true
   "DisableAllocatorDualWrite": true
```

Fix patch:
diff --git a/pkg/registry/core/rest/storage_core.go b/pkg/registry/core/rest/storage_core.go
index e5ced412aadca..bac4b133de1c1 100644
--- a/pkg/registry/core/rest/storage_core.go
+++ b/pkg/registry/core/rest/storage_core.go
@@ -440,7 +440,7 @@ func (c *Config) newServiceIPAllocators() (registries rangeRegistries, primaryCl
 					if err != nil {
 						return nil, err
 					}
-					rangeRegistry.Range = serviceClusterIPRange.String()
+					rangeRegistry.Range = c.Services.SecondaryClusterIPRange.String()
 					if len(rangeRegistry.ResourceVersion) == 0 {
 						klog.Infof("kube-apiserver started with IP allocator and dual write enabled but bitmap allocator does not exist, recreating it ...")
 						err := etcd.CreateOrUpdate(rangeRegistry)


Test patch:
diff --git a/test/integration/dualstack/dualstack_test.go b/test/integration/dualstack/dualstack_test.go
index 01ab3323cd9e5..d6a1cc16727ff 100644
--- a/test/integration/dualstack/dualstack_test.go
+++ b/test/integration/dualstack/dualstack_test.go
@@ -31,11 +31,11 @@ import (
 	apierrors "k8s.io/apimachinery/pkg/api/errors"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/types"
-
 	"k8s.io/apimachinery/pkg/util/intstr"
 	"k8s.io/apimachinery/pkg/util/wait"
-
-	"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
+	"k8s.io/client-go/kubernetes"
+	kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
+	"k8s.io/kubernetes/pkg/features"
 	"k8s.io/kubernetes/test/integration/framework"
 	"k8s.io/kubernetes/test/utils/ktesting"
 	netutils "k8s.io/utils/net"
@@ -43,945 +43,1012 @@ import (
 
 // TestCreateServiceSingleStackIPv4 test the Service dualstackness in an IPv4 SingleStack cluster
 func TestCreateServiceSingleStackIPv4(t *testing.T) {
-	// Create an IPv4 single stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-
-	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = serviceCIDR
-		},
-	})
-	defer tearDownFn()
-
-	// Wait until the default "kubernetes" service is created.
-	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
-		_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
-		if err != nil && !apierrors.IsNotFound(err) {
-			return false, err
-		}
-		return !apierrors.IsNotFound(err), nil
-	}); err != nil {
-		t.Fatalf("creating kubernetes service timed out")
-	}
-
-	var testcases = []struct {
-		name               string
-		serviceType        v1.ServiceType
-		clusterIPs         []string
-		ipFamilies         []v1.IPFamily
-		ipFamilyPolicy     v1.IPFamilyPolicy
-		expectedIPFamilies []v1.IPFamily
-		expectError        bool
-	}{
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         nil,
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - Default IP Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"10.0.0.16"},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         nil,
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         nil,
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        true,
-		},
-	}
-
-	for i, tc := range testcases {
-		tc := tc
-		t.Run(tc.name, func(t *testing.T) {
-
-			svc := &v1.Service{
-				ObjectMeta: metav1.ObjectMeta{
-					Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
-				},
-				Spec: v1.ServiceSpec{
-					Type:       tc.serviceType,
-					ClusterIPs: tc.clusterIPs,
-					IPFamilies: tc.ipFamilies,
-					Ports: []v1.ServicePort{
-						{
-							Port:       443,
-							TargetPort: intstr.FromInt32(443),
-						},
+	for _, enableMultiServiceCIDR := range []bool{false, true} {
+		for _, disableAllocatorDualWrite := range []bool{false, true} {
+			t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) {
+				// Create an IPv4 single stack control-plane
+				tCtx := ktesting.Init(t)
+				etcdOptions := framework.SharedEtcd()
+				apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+				s := kubeapiservertesting.StartTestServerOrDie(t,
+					apiServerOptions,
+					[]string{
+						fmt.Sprintf("--runtime-config=networking.k8s.io/v1beta1=%v", enableMultiServiceCIDR),
+						"--service-cluster-ip-range=10.0.0.0/16",
+						"--advertise-address=10.1.1.1",
+						"--disable-admission-plugins=ServiceAccount",
+						fmt.Sprintf("--feature-gates=%s=%v,%s=%v", features.MultiCIDRServiceAllocator, enableMultiServiceCIDR, features.DisableAllocatorDualWrite, disableAllocatorDualWrite),
 					},
-				},
-			}
-
-			if len(tc.ipFamilyPolicy) > 0 {
-				svc.Spec.IPFamilyPolicy = &tc.ipFamilyPolicy
-			}
-
-			if len(tc.clusterIPs) > 0 {
-				svc.Spec.ClusterIP = tc.clusterIPs[0]
-			}
-
-			// create the service
-			_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
-			if (err != nil) != tc.expectError {
-				t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
-			}
-			// if no error was expected validate the service otherwise return
-			if err != nil {
-				return
-			}
-			// validate the service was created correctly if it was not expected to fail
-			svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
-			if err != nil {
-				t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
-			}
-			if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
-				t.Errorf("Unexpected error validating the service %s\n%+v\n%v", svc.Name, svc, err)
-			}
-		})
-	}
-}
-
-// TestCreateServiceDualStackIPv6 test the Service dualstackness in an IPv6 only DualStack cluster
-func TestCreateServiceDualStackIPv6(t *testing.T) {
-	// Create an IPv6 only dual stack control-plane
-	serviceCIDR := "2001:db8:1::/112"
-
-	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = serviceCIDR
-			opts.GenericServerRunOptions.AdvertiseAddress = netutils.ParseIPSloppy("2001:db8::10")
-		},
-	})
-	defer tearDownFn()
-
-	// Wait until the default "kubernetes" service is created.
-	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
-		_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
-		if err != nil && !apierrors.IsNotFound(err) {
-			return false, err
+					etcdOptions)
+				defer s.TearDownFn()
+
+				client, err := kubernetes.NewForConfig(s.ClientConfig)
+				if err != nil {
+					t.Fatalf("Unexpected error: %v", err)
+				}
+
+				// Wait until the default "kubernetes" service is created.
+				if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
+					_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
+					if err != nil && !apierrors.IsNotFound(err) {
+						return false, err
+					}
+					return !apierrors.IsNotFound(err), nil
+				}); err != nil {
+					t.Fatalf("creating kubernetes service timed out")
+				}
+
+				var testcases = []struct {
+					name               string
+					serviceType        v1.ServiceType
+					clusterIPs         []string
+					ipFamilies         []v1.IPFamily
+					ipFamilyPolicy     v1.IPFamilyPolicy
+					expectedIPFamilies []v1.IPFamily
+					expectError        bool
+				}{
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         nil,
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - Default IP Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"10.0.0.16"},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         nil,
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         nil,
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        true,
+					},
+				}
+
+				for i, tc := range testcases {
+					tc := tc
+					t.Run(tc.name, func(t *testing.T) {
+
+						svc := &v1.Service{
+							ObjectMeta: metav1.ObjectMeta{
+								Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
+							},
+							Spec: v1.ServiceSpec{
+								Type:       tc.serviceType,
+								ClusterIPs: tc.clusterIPs,
+								IPFamilies: tc.ipFamilies,
+								Ports: []v1.ServicePort{
+									{
+										Port:       443,
+										TargetPort: intstr.FromInt32(443),
+									},
+								},
+							},
+						}
+
+						if len(tc.ipFamilyPolicy) > 0 {
+							svc.Spec.IPFamilyPolicy = &tc.ipFamilyPolicy
+						}
+
+						if len(tc.clusterIPs) > 0 {
+							svc.Spec.ClusterIP = tc.clusterIPs[0]
+						}
+
+						// create the service
+						_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+						if (err != nil) != tc.expectError {
+							t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
+						}
+						// if no error was expected validate the service otherwise return
+						if err != nil {
+							return
+						}
+						// validate the service was created correctly if it was not expected to fail
+						svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
+						if err != nil {
+							t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
+						}
+						if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
+							t.Errorf("Unexpected error validating the service %s\n%+v\n%v", svc.Name, svc, err)
+						}
+					})
+				}
+			})
 		}
-		return !apierrors.IsNotFound(err), nil
-	}); err != nil {
-		t.Fatalf("creating kubernetes service timed out")
 	}
+}
 
-	var testcases = []struct {
-		name               string
-		serviceType        v1.ServiceType
-		clusterIPs         []string
-		ipFamilies         []v1.IPFamily
-		expectedIPFamilies []v1.IPFamily
-		ipFamilyPolicy     v1.IPFamilyPolicy
-		expectError        bool
-	}{
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        true,
-		},
-	}
-
-	for i, tc := range testcases {
-		tc := tc
-		t.Run(tc.name, func(t *testing.T) {
-
-			svc := &v1.Service{
-				ObjectMeta: metav1.ObjectMeta{
-					Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
-				},
-				Spec: v1.ServiceSpec{
-					Type:           tc.serviceType,
-					ClusterIPs:     tc.clusterIPs,
-					IPFamilies:     tc.ipFamilies,
-					IPFamilyPolicy: &tc.ipFamilyPolicy,
-					Ports: []v1.ServicePort{
-						{
-							Name:       fmt.Sprintf("port-test-%d", i),
-							Port:       443,
-							TargetPort: intstr.IntOrString{IntVal: 443},
-							Protocol:   "TCP",
-						},
+// TestCreateServiceSingleStackIPv6 test the Service dualstackness in an IPv6 only DualStack cluster
+func TestCreateServiceSingleStackIPv6(t *testing.T) {
+	for _, enableMultiServiceCIDR := range []bool{false, true} {
+		for _, disableAllocatorDualWrite := range []bool{false, true} {
+			t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) {
+				// Create an IPv6 only control-plane
+				tCtx := ktesting.Init(t)
+				etcdOptions := framework.SharedEtcd()
+				apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+				s := kubeapiservertesting.StartTestServerOrDie(t,
+					apiServerOptions,
+					[]string{
+						fmt.Sprintf("--runtime-config=networking.k8s.io/v1beta1=%v", enableMultiServiceCIDR),
+						"--service-cluster-ip-range=2001:db8:1::/112",
+						"--advertise-address=2001:db8::10",
+						"--disable-admission-plugins=ServiceAccount",
+						fmt.Sprintf("--feature-gates=%s=%v,%s=%v", features.MultiCIDRServiceAllocator, enableMultiServiceCIDR, features.DisableAllocatorDualWrite, disableAllocatorDualWrite),
 					},
-				},
-			}
-
-			// create the service
-			_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
-			if (err != nil) != tc.expectError {
-				t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
-			}
-			// if no error was expected validate the service otherwise return
-			if err != nil {
-				return
-			}
-			// validate the service was created correctly if it was not expected to fail
-			svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
-			if err != nil {
-				t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
-			}
-			if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
-				t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
-			}
-		})
+					etcdOptions)
+				defer s.TearDownFn()
+
+				client, err := kubernetes.NewForConfig(s.ClientConfig)
+				if err != nil {
+					t.Fatalf("Unexpected error: %v", err)
+				}
+
+				// Wait until the default "kubernetes" service is created.
+				if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
+					_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
+					if err != nil && !apierrors.IsNotFound(err) {
+						return false, err
+					}
+					return !apierrors.IsNotFound(err), nil
+				}); err != nil {
+					t.Fatalf("creating kubernetes service timed out")
+				}
+
+				var testcases = []struct {
+					name               string
+					serviceType        v1.ServiceType
+					clusterIPs         []string
+					ipFamilies         []v1.IPFamily
+					expectedIPFamilies []v1.IPFamily
+					ipFamilyPolicy     v1.IPFamilyPolicy
+					expectError        bool
+				}{
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        true,
+					},
+				}
+
+				for i, tc := range testcases {
+					tc := tc
+					t.Run(tc.name, func(t *testing.T) {
+
+						svc := &v1.Service{
+							ObjectMeta: metav1.ObjectMeta{
+								Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
+							},
+							Spec: v1.ServiceSpec{
+								Type:           tc.serviceType,
+								ClusterIPs:     tc.clusterIPs,
+								IPFamilies:     tc.ipFamilies,
+								IPFamilyPolicy: &tc.ipFamilyPolicy,
+								Ports: []v1.ServicePort{
+									{
+										Name:       fmt.Sprintf("port-test-%d", i),
+										Port:       443,
+										TargetPort: intstr.IntOrString{IntVal: 443},
+										Protocol:   "TCP",
+									},
+								},
+							},
+						}
+
+						// create the service
+						_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+						if (err != nil) != tc.expectError {
+							t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
+						}
+						// if no error was expected validate the service otherwise return
+						if err != nil {
+							return
+						}
+						// validate the service was created correctly if it was not expected to fail
+						svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
+						if err != nil {
+							t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
+						}
+						if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
+							t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
+						}
+					})
+				}
+			})
+		}
 	}
 }
 
 // TestCreateServiceDualStackIPv4IPv6 test the Service dualstackness in a IPv4IPv6 DualStack cluster
 func TestCreateServiceDualStackIPv4IPv6(t *testing.T) {
-	// Create an IPv4IPv6 dual stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
-	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-		},
-	})
-	defer tearDownFn()
-
-	// Wait until the default "kubernetes" service is created.
-	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
-		_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
-		if err != nil && !apierrors.IsNotFound(err) {
-			return false, err
-		}
-		return !apierrors.IsNotFound(err), nil
-	}); err != nil {
-		t.Fatalf("creating kubernetes service timed out")
-	}
-
-	var testcases = []struct {
-		name               string
-		serviceType        v1.ServiceType
-		clusterIPs         []string
-		ipFamilies         []v1.IPFamily
-		expectedIPFamilies []v1.IPFamily
-		ipFamilyPolicy     v1.IPFamilyPolicy
-		expectError        bool
-	}{
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - IPv4 Family",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"10.0.0.16"},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - IPv6 Family",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"2001:db8:1::16"},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"10.0.0.17", "2001:db8:1::17"},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"10.0.0.17", "2001:db8:1::17"},
-			ipFamilies:         nil,
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{"10.0.0.18", "2001:db8:1::18"},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-	}
-
-	for i, tc := range testcases {
-		tc := tc
-		t.Run(tc.name, func(t *testing.T) {
+	for _, enableMultiServiceCIDR := range []bool{false, true} {
+		for _, disableAllocatorDualWrite := range []bool{false, true} {
+			t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) {
+				// Create an IPv4IPv6 dual stack control-plane
+				tCtx := ktesting.Init(t)
+				etcdOptions := framework.SharedEtcd()
+				apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+				s := kubeapiservertesting.StartTestServerOrDie(t,
+					apiServerOptions,
+					[]string{
+						fmt.Sprintf("--runtime-config=networking.k8s.io/v1beta1=%v", enableMultiServiceCIDR),
+						"--service-cluster-ip-range=10.0.0.0/16,2001:db8:1::/112",
+						"--advertise-address=10.0.0.1",
+						"--disable-admission-plugins=ServiceAccount",
+						fmt.Sprintf("--feature-gates=%s=%v,%s=%v", features.MultiCIDRServiceAllocator, enableMultiServiceCIDR, features.DisableAllocatorDualWrite, disableAllocatorDualWrite),
+					},
+					etcdOptions)
+				defer s.TearDownFn()
+
+				client, err := kubernetes.NewForConfig(s.ClientConfig)
+				if err != nil {
+					t.Fatalf("Unexpected error: %v", err)
+				}
+
+				// Wait until the default "kubernetes" service is created.
+				if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
+					_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
+					if err != nil && !apierrors.IsNotFound(err) {
+						return false, err
+					}
+					return !apierrors.IsNotFound(err), nil
+				}); err != nil {
+					t.Fatalf("creating kubernetes service timed out")
+				}
+
+				var testcases = []struct {
+					name               string
+					serviceType        v1.ServiceType
+					clusterIPs         []string
+					ipFamilies         []v1.IPFamily
+					expectedIPFamilies []v1.IPFamily
+					ipFamilyPolicy     v1.IPFamilyPolicy
+					expectError        bool
+				}{
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - IPv4 Family",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"10.0.0.16"},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - IPv6 Family",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"2001:db8:1::16"},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"10.0.0.17", "2001:db8:1::17"},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"10.0.0.17", "2001:db8:1::17"},
+						ipFamilies:         nil,
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Client Allocated IP - IPv4 IPv6 Family ",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{"10.0.0.18", "2001:db8:1::18"},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
 
-			svc := &v1.Service{
-				ObjectMeta: metav1.ObjectMeta{
-					Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
-				},
-				Spec: v1.ServiceSpec{
-					Type:       tc.serviceType,
-					ClusterIPs: tc.clusterIPs,
-					IPFamilies: tc.ipFamilies,
-					Ports: []v1.ServicePort{
-						{
-							Port:       443,
-							TargetPort: intstr.FromInt32(443),
-						},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
 					},
-				},
-			}
-
-			if len(tc.ipFamilyPolicy) > 0 {
-				svc.Spec.IPFamilyPolicy = &tc.ipFamilyPolicy
-			}
-
-			if len(tc.clusterIPs) > 0 {
-				svc.Spec.ClusterIP = tc.clusterIPs[0]
-			}
-
-			// create a service
-			_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
-			if (err != nil) != tc.expectError {
-				t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
-			}
-			// if no error was expected validate the service otherwise return
-			if err != nil {
-				return
-			}
-			// validate the service was created correctly if it was not expected to fail
-			svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
-			if err != nil {
-				t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
-			}
-
-			if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
-				t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
-			}
-		})
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+				}
+
+				for i, tc := range testcases {
+					tc := tc
+					t.Run(tc.name, func(t *testing.T) {
+
+						svc := &v1.Service{
+							ObjectMeta: metav1.ObjectMeta{
+								Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
+							},
+							Spec: v1.ServiceSpec{
+								Type:       tc.serviceType,
+								ClusterIPs: tc.clusterIPs,
+								IPFamilies: tc.ipFamilies,
+								Ports: []v1.ServicePort{
+									{
+										Port:       443,
+										TargetPort: intstr.FromInt32(443),
+									},
+								},
+							},
+						}
+
+						if len(tc.ipFamilyPolicy) > 0 {
+							svc.Spec.IPFamilyPolicy = &tc.ipFamilyPolicy
+						}
+
+						if len(tc.clusterIPs) > 0 {
+							svc.Spec.ClusterIP = tc.clusterIPs[0]
+						}
+
+						// create a service
+						_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+						if (err != nil) != tc.expectError {
+							t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
+						}
+						// if no error was expected validate the service otherwise return
+						if err != nil {
+							return
+						}
+						// validate the service was created correctly if it was not expected to fail
+						svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
+						if err != nil {
+							t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
+						}
+
+						if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
+							t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
+						}
+					})
+				}
+			})
+		}
 	}
 }
 
 // TestCreateServiceDualStackIPv6IPv4 test the Service dualstackness in a IPv6IPv4 DualStack cluster
 func TestCreateServiceDualStackIPv6IPv4(t *testing.T) {
-	// Create an IPv6IPv4 dual stack control-plane
-	serviceCIDR := "2001:db8:1::/112"
-	secondaryServiceCIDR := "10.0.0.0/16"
-
-	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-			opts.GenericServerRunOptions.AdvertiseAddress = netutils.ParseIPSloppy("2001:db8::10")
-		},
-	})
-	defer tearDownFn()
-
-	// Wait until the default "kubernetes" service is created.
-	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
-		_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
-		if err != nil && !apierrors.IsNotFound(err) {
-			return false, err
-		}
-		return !apierrors.IsNotFound(err), nil
-	}); err != nil {
-		t.Fatalf("creating kubernetes service timed out")
-	}
-
-	// verify client is working
-	if err := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) {
-		_, err := client.CoreV1().Endpoints("default").Get(tCtx, "kubernetes", metav1.GetOptions{})
-		if err != nil {
-			t.Logf("error fetching endpoints: %v", err)
-			return false, nil
-		}
-		return true, nil
-	}); err != nil {
-		t.Errorf("server without enabled endpoints failed to register: %v", err)
-	}
-
-	var testcases = []struct {
-		name               string
-		serviceType        v1.ServiceType
-		clusterIPs         []string
-		ipFamilies         []v1.IPFamily
-		expectedIPFamilies []v1.IPFamily
-		ipFamilyPolicy     v1.IPFamilyPolicy
-		expectError        bool
-	}{
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         nil,
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
-			expectError:        true,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
-			expectError:        false,
-		},
-		{
-			name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
-			serviceType:        v1.ServiceTypeClusterIP,
-			clusterIPs:         []string{},
-			ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
-			ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
-			expectError:        false,
-		},
-	}
-
-	for i, tc := range testcases {
-		tc := tc
-		t.Run(tc.name, func(t *testing.T) {
+	for _, enableMultiServiceCIDR := range []bool{false, true} {
+		for _, disableAllocatorDualWrite := range []bool{false, true} {
+			t.Run(fmt.Sprintf("MultiServiceCIDR=%v DisableAllocatorDualWrite=%v", enableMultiServiceCIDR, disableAllocatorDualWrite), func(t *testing.T) {
+				// Create an IPv6IPv4 dual stack control-plane
+				tCtx := ktesting.Init(t)
+				etcdOptions := framework.SharedEtcd()
+				apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+				s := kubeapiservertesting.StartTestServerOrDie(t,
+					apiServerOptions,
+					[]string{
+						fmt.Sprintf("--runtime-config=networking.k8s.io/v1beta1=%v", enableMultiServiceCIDR),
+						"--service-cluster-ip-range=2001:db8:1::/112,10.0.0.0/16",
+						"--advertise-address=2001:db8::10",
+						"--disable-admission-plugins=ServiceAccount",
+						fmt.Sprintf("--feature-gates=%s=%v,%s=%v", features.MultiCIDRServiceAllocator, enableMultiServiceCIDR, features.DisableAllocatorDualWrite, disableAllocatorDualWrite),
+					},
+					etcdOptions)
+				defer s.TearDownFn()
+
+				client, err := kubernetes.NewForConfig(s.ClientConfig)
+				if err != nil {
+					t.Fatalf("Unexpected error: %v", err)
+				}
+
+				// Wait until the default "kubernetes" service is created.
+				if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
+					_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
+					if err != nil && !apierrors.IsNotFound(err) {
+						return false, err
+					}
+					return !apierrors.IsNotFound(err), nil
+				}); err != nil {
+					t.Fatalf("creating kubernetes service timed out")
+				}
+
+				// verify client is working
+				if err := wait.PollImmediate(5*time.Second, 2*time.Minute, func() (bool, error) {
+					_, err := client.CoreV1().Endpoints("default").Get(tCtx, "kubernetes", metav1.GetOptions{})
+					if err != nil {
+						t.Logf("error fetching endpoints: %v", err)
+						return false, nil
+					}
+					return true, nil
+				}); err != nil {
+					t.Errorf("server without enabled endpoints failed to register: %v", err)
+				}
+
+				var testcases = []struct {
+					name               string
+					serviceType        v1.ServiceType
+					clusterIPs         []string
+					ipFamilies         []v1.IPFamily
+					expectedIPFamilies []v1.IPFamily
+					ipFamilyPolicy     v1.IPFamilyPolicy
+					expectError        bool
+				}{
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - Default IP Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         nil,
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
 
-			svc := &v1.Service{
-				ObjectMeta: metav1.ObjectMeta{
-					Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
-				},
-				Spec: v1.ServiceSpec{
-					Type:           tc.serviceType,
-					ClusterIPs:     tc.clusterIPs,
-					IPFamilies:     tc.ipFamilies,
-					IPFamilyPolicy: &tc.ipFamilyPolicy,
-					Ports: []v1.ServicePort{
-						{
-							Port:       443,
-							TargetPort: intstr.FromInt32(443),
-						},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
 					},
-				},
-			}
-
-			// create a service
-			_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
-			if (err != nil) != tc.expectError {
-				t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
-			}
-			// if no error was expected validate the service otherwise return
-			if err != nil {
-				return
-			}
-			// validate the service was created correctly if it was not expected to fail
-			svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
-			if err != nil {
-				t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
-			}
-
-			if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
-				t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
-			}
-		})
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv4 IPv6 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Single Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicySingleStack,
+						expectError:        true,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Prefer Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyPreferDualStack,
+						expectError:        false,
+					},
+					{
+						name:               "Type ClusterIP - Server Allocated IP - IPv6 IPv4 Family - Policy Required Dual Stack",
+						serviceType:        v1.ServiceTypeClusterIP,
+						clusterIPs:         []string{},
+						ipFamilies:         []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						expectedIPFamilies: []v1.IPFamily{v1.IPv6Protocol, v1.IPv4Protocol},
+						ipFamilyPolicy:     v1.IPFamilyPolicyRequireDualStack,
+						expectError:        false,
+					},
+				}
+
+				for i, tc := range testcases {
+					tc := tc
+					t.Run(tc.name, func(t *testing.T) {
+
+						svc := &v1.Service{
+							ObjectMeta: metav1.ObjectMeta{
+								Name: fmt.Sprintf("svc-test-%d", i), // use different services for each test
+							},
+							Spec: v1.ServiceSpec{
+								Type:           tc.serviceType,
+								ClusterIPs:     tc.clusterIPs,
+								IPFamilies:     tc.ipFamilies,
+								IPFamilyPolicy: &tc.ipFamilyPolicy,
+								Ports: []v1.ServicePort{
+									{
+										Port:       443,
+										TargetPort: intstr.FromInt32(443),
+									},
+								},
+							},
+						}
+
+						// create a service
+						_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+						if (err != nil) != tc.expectError {
+							t.Errorf("Test failed expected result: %v received %v ", tc.expectError, err)
+						}
+						// if no error was expected validate the service otherwise return
+						if err != nil {
+							return
+						}
+						// validate the service was created correctly if it was not expected to fail
+						svc, err = client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, svc.Name, metav1.GetOptions{})
+						if err != nil {
+							t.Errorf("Unexpected error to get the service %s %v", svc.Name, err)
+						}
+
+						if err := validateServiceAndClusterIPFamily(svc, tc.expectedIPFamilies); err != nil {
+							t.Errorf("Unexpected error validating the service %s %v", svc.Name, err)
+						}
+					})
+				}
+			})
+		}
 	}
 }
 
 // TestUpgradeDowngrade tests upgrading and downgrading a service from/to dual-stack
 func TestUpgradeDowngrade(t *testing.T) {
 	// Create an IPv4IPv6 dual stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
 	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-		},
-	})
-	defer tearDownFn()
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=10.0.0.0/16,2001:db8:1::/112",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+	defer s.TearDownFn()
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1012,7 +1079,7 @@ func TestUpgradeDowngrade(t *testing.T) {
 	}
 
 	// create a service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("unexpected error while creating service:%v", err)
 	}
@@ -1076,16 +1143,23 @@ func TestUpgradeDowngrade(t *testing.T) {
 // may not clear ClusterIPs
 func TestConvertToFromExternalName(t *testing.T) {
 	// Create an IPv4IPv6 dual stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
 	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-		},
-	})
-	defer tearDownFn()
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=10.0.0.0/16,2001:db8:1::/112",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+	defer s.TearDownFn()
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1115,7 +1189,7 @@ func TestConvertToFromExternalName(t *testing.T) {
 	}
 
 	// create a service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("unexpected error while creating service:%v", err)
 	}
@@ -1158,16 +1232,23 @@ func TestConvertToFromExternalName(t *testing.T) {
 // TestPreferDualStack preferDualstack on create and update
 func TestPreferDualStack(t *testing.T) {
 	// Create an IPv4IPv6 dual stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
 	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-		},
-	})
-	defer tearDownFn()
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=10.0.0.0/16,2001:db8:1::/112",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+	defer s.TearDownFn()
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1201,7 +1282,7 @@ func TestPreferDualStack(t *testing.T) {
 	}
 
 	// create a service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("unexpected error while creating service:%v", err)
 	}
@@ -1233,15 +1314,23 @@ type labelsForMergePatch struct {
 // tests an update service while dualstack flag is off
 func TestServiceUpdate(t *testing.T) {
 	// Create an IPv4 single stack control-plane
-	serviceCIDR := "10.0.0.0/16"
-
 	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.ServiceClusterIPRanges = serviceCIDR
-		},
-	})
-	defer tearDownFn()
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=10.0.0.0/16",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+	defer s.TearDownFn()
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1271,7 +1360,7 @@ func TestServiceUpdate(t *testing.T) {
 	}
 
 	// create the service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	// if no error was expected validate the service otherwise return
 	if err != nil {
 		t.Errorf("unexpected error creating service:%v", err)
@@ -1393,18 +1482,23 @@ func validateServiceAndClusterIPFamily(svc *v1.Service, expectedIPFamilies []v1.
 
 func TestUpgradeServicePreferToDualStack(t *testing.T) {
 	sharedEtcd := framework.SharedEtcd()
-
 	tCtx := ktesting.Init(t)
 
 	// Create an IPv4 only dual stack control-plane
-	serviceCIDR := "192.168.0.0/24"
-
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.Etcd.StorageConfig = *sharedEtcd
-			opts.ServiceClusterIPRanges = serviceCIDR
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=192.168.0.0/24",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
 		},
-	})
+		sharedEtcd)
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1439,7 +1533,7 @@ func TestUpgradeServicePreferToDualStack(t *testing.T) {
 	}
 
 	// create the service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("Unexpected error: %v", err)
 	}
@@ -1453,17 +1547,21 @@ func TestUpgradeServicePreferToDualStack(t *testing.T) {
 	}
 
 	// reconfigure the apiserver to be dual-stack
-	tearDownFn()
+	s.TearDownFn()
 
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
-	client, _, tearDownFn = framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.Etcd.StorageConfig = *sharedEtcd
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
+	s = kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=192.168.0.0/24,2001:db8:1::/112",
+			"--disable-admission-plugins=ServiceAccount",
 		},
-	})
-	defer tearDownFn()
+		sharedEtcd)
+	defer s.TearDownFn()
+
+	client, err = kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err = wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1487,20 +1585,24 @@ func TestUpgradeServicePreferToDualStack(t *testing.T) {
 }
 
 func TestDowngradeServicePreferToDualStack(t *testing.T) {
-	sharedEtcd := framework.SharedEtcd()
-
 	tCtx := ktesting.Init(t)
 
 	// Create a dual stack control-plane
-	serviceCIDR := "192.168.0.0/24"
-	secondaryServiceCIDR := "2001:db8:1::/112"
-
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.Etcd.StorageConfig = *sharedEtcd
-			opts.ServiceClusterIPRanges = fmt.Sprintf("%s,%s", serviceCIDR, secondaryServiceCIDR)
-		},
-	})
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=192.168.0.0/24,2001:db8:1::/112",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	// Wait until the default "kubernetes" service is created.
 	if err := wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
@@ -1533,7 +1635,7 @@ func TestDowngradeServicePreferToDualStack(t *testing.T) {
 		},
 	}
 	// create the service
-	_, err := client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
+	_, err = client.CoreV1().Services(metav1.NamespaceDefault).Create(tCtx, svc, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("Unexpected error: %v", err)
 	}
@@ -1545,18 +1647,24 @@ func TestDowngradeServicePreferToDualStack(t *testing.T) {
 	if err := validateServiceAndClusterIPFamily(svc, []v1.IPFamily{v1.IPv4Protocol, v1.IPv6Protocol}); err != nil {
 		t.Fatalf("Unexpected error validating the service %s %v", svc.Name, err)
 	}
-	// reconfigure the apiserver to be sinlge stack
-	tearDownFn()
+	// reconfigure the apiserver to be single stack
+	s.TearDownFn()
 
 	// reset secondary
-	client, _, tearDownFn = framework.StartTestServer(tCtx, t, framework.TestServerSetup{
-		ModifyServerRunOptions: func(opts *options.ServerRunOptions) {
-			opts.Etcd.StorageConfig = *sharedEtcd
-			opts.ServiceClusterIPRanges = serviceCIDR
+	s = kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=192.168.0.0/24",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
 		},
-	})
-	defer tearDownFn()
+		etcdOptions)
+	defer s.TearDownFn()
 
+	client, err = kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 	// Wait until the default "kubernetes" service is created.
 	if err = wait.Poll(250*time.Millisecond, time.Minute, func() (bool, error) {
 		_, err := client.CoreV1().Services(metav1.NamespaceDefault).Get(tCtx, "kubernetes", metav1.GetOptions{})
@@ -1589,8 +1697,22 @@ type specMergePatch struct {
 // tests success when converting ClusterIP:Headless service to ExternalName
 func Test_ServiceChangeTypeHeadlessToExternalNameWithPatch(t *testing.T) {
 	tCtx := ktesting.Init(t)
-	client, _, tearDownFn := framework.StartTestServer(tCtx, t, framework.TestServerSetup{})
-	defer tearDownFn()
+	etcdOptions := framework.SharedEtcd()
+	apiServerOptions := kubeapiservertesting.NewDefaultTestServerOptions()
+	s := kubeapiservertesting.StartTestServerOrDie(t,
+		apiServerOptions,
+		[]string{
+			"--service-cluster-ip-range=192.168.0.0/24",
+			"--advertise-address=10.0.0.1",
+			"--disable-admission-plugins=ServiceAccount",
+		},
+		etcdOptions)
+	defer s.TearDownFn()
+
+	client, err := kubernetes.NewForConfig(s.ClientConfig)
+	if err != nil {
+		t.Fatalf("Unexpected error: %v", err)
+	}
 
 	ns := framework.CreateNamespaceOrDie(client, "test-service-allocate-node-ports", t)
 	defer framework.DeleteNamespaceOrDie(client, ns, t)
@@ -1606,7 +1728,6 @@ func Test_ServiceChangeTypeHeadlessToExternalNameWithPatch(t *testing.T) {
 		},
 	}
 
-	var err error
 	service, err = client.CoreV1().Services(ns.Name).Create(tCtx, service, metav1.CreateOptions{})
 	if err != nil {
 		t.Fatalf("Error creating test service: %v", err)