0
在docker run命令中,我们可以指定主机端口范围以绑定到EXPOSEd容器端口。我想通过Kubernetes做同样的事情。有谁知道这是怎么做到的吗?我当前的pod定义如下所示:如何在kubernete的pod yaml文件中指定主机端口范围而不是主机端口?
apiVersion: v1
kind: Pod
metadata:
name: nginx-testing
spec:
containers:
- name: nginx-container
image: docker.io/nginx
ports:
- containerPort: 80
hostPort: 9088
在最后一行,我没有指定单个端口号,而是想要一个范围的端口号。我尝试了类似hostPort: 9088-9999 or 9088..9999
,但它不起作用。
这应该有助于http://stackoverflow.com/questions/35409684/how-to-allow-a-range-of-ports-in-kubernetes-in-containerport-variable –
@ThanhNguyenVan谢谢..它意味着我们无法在kubernetes中指定范围端口。 –