如何在 containerPort 变量中允许 Kubernetes 中的一系列端口?
How to allow a range of ports in Kubernetes in containerPort variable?
在 docker 中,我可以使用“-p 65000-65050:65000-65050”公开一系列端口。我如何在 pod.yml 或复制-controller.yml 中为 kubernetes 实现此目的?
你不能。来自 v1 API 规范:
"ports": [
{
"name": "string",
"hostPort": 0,
"containerPort": 0,
"protocol": "string",
"hostIP": "string"
}
]
每个端口都是唯一标识的,公开主机端口将是 Kubernetes 中的反模式。
在 docker 中,我可以使用“-p 65000-65050:65000-65050”公开一系列端口。我如何在 pod.yml 或复制-controller.yml 中为 kubernetes 实现此目的?
你不能。来自 v1 API 规范:
"ports": [
{
"name": "string",
"hostPort": 0,
"containerPort": 0,
"protocol": "string",
"hostIP": "string"
}
]
每个端口都是唯一标识的,公开主机端口将是 Kubernetes 中的反模式。