--- title: DefaultHostNetworkHostPortsInPodTemplates content_type: feature_gate _build: list: never render: false stages: - stage: deprecated defaultValue: false fromVersion: "1.28" toVersion: "1.30" removed: true --- 此特性门控将控制何时为使用 `hostNetwork: true` 的 Pod 设置 `.spec.containers[*].ports[*].hostPort` 默认值。 启用此特性意味着默认值甚至会分配给嵌入式 [PodTemplate](/zh-cn/docs/concepts/workloads/pods/#pod-templates)(例如,Deployment) 的 `.spec`,这是 Kubernetes 旧版本的工作方式。 你应该迁移你的代码,使其不再依赖于原先的行为。