Address families for Services

The ipFamilyPolicy field of a Kubernetes Service determines which address families the Service uses, and the ipFamilies field sets their order of preference.

The ipFamilyPolicy field of a Kubernetes Service determines which address families the Service uses:

SingleStack

The Service receives a cluster IP address in one address family. This value is the Kubernetes default.

PreferDualStack

The Service receives cluster IP addresses in both families when the cluster supports dual-stack networking, and in one family otherwise.

RequireDualStack

The Service receives cluster IP addresses in both families. The API server rejects the Service if the cluster does not support dual-stack networking.

The ipFamilies field lists the address families in order of preference. The following example defines a Service that requires both address families:

apiVersion: v1
kind: Service
metadata:
  name: example-service
spec:
  ipFamilyPolicy: RequireDualStack
  ipFamilies:
    - IPv4
    - IPv6
  selector:
    app: example-app
  ports:
    - protocol: TCP
      port: 80