website/content/en/docs/reference/command-line-tools-reference/feature-gates/DefaultHostNetworkHostPorts...

780 B

title content_type _build stages removed
DefaultHostNetworkHostPortsInPodTemplates feature_gate
list render
never false
stage defaultValue fromVersion toVersion
deprecated false 1.28 1.30
true

This feature gate controls the point at which a default value for .spec.containers[*].ports[*].hostPort is assigned, for Pods using hostNetwork: true. The default since Kubernetes v1.28 is to only set a default value in Pods.

Enabling this means a default will be assigned even to the .spec of an embedded PodTemplate (for example, in a Deployment), which is the way that older releases of Kubernetes worked. You should migrate your code so that it does not rely on the legacy behavior.