本文介绍了如何允许在库伯纳斯的一系列端口在containerPort变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在docker中,我可以使用-p 65000-65050:65000-65050来显示一系列端口。如何在pod.yml或replication-controller.yml中为kubernetes实现此目的?

解决方案

你不能。从v1 API规范:

 ports:[
{
name:string
hostPort:0,
containerPort:0,
protocol:string,
hostIP:string
}
]

每个端口都是唯一标识的,并且显示主机端口将是一个反模式Kubernetes。


In docker, I can expose a range of ports using "-p 65000-65050:65000-65050". How do I achieve this for kubernetes in a pod.yml or replication-controller.yml?

解决方案

You can't. From the v1 API specs:

      "ports": [
        {
          "name": "string",
          "hostPort": 0,
          "containerPort": 0,
          "protocol": "string",
          "hostIP": "string"
        }
      ]

Each port is uniquely identified and exposing host ports would be an anti-pattern in Kubernetes.

这篇关于如何允许在库伯纳斯的一系列端口在containerPort变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 19:14