How to specify host port range instead of host port in kubernete's pod yaml file?

7/20/2016

In docker run command, we can specify host port range to bind to EXPOSEd container port. Same thing I want to do through Kubernetes. Does any one know, how to do that? My current pod definition is as-

apiVersion: v1  
kind: Pod  
metadata:  
  name: nginx-testing  
spec:  
   containers:  
   - name: nginx-container  
     image: docker.io/nginx  
     ports:  
     - containerPort: 80  
       hostPort: 9088  

At the last line, Instead of specifying single port number, I want a range of port numbers. I tried something like hostPort: 9088-9999 or 9088..9999, but it wouldn't worked.

-- Yogesh Jilhawar
docker
kubernetes
kubernetes-pod
port

1 Answer

7/20/2016

Port ranges are not currently supported in any of the Kubernetes API objects. There is an open issue discussing port ranges in services. Please add your use case and your thoughts!

-- CJ Cullen
Source: StackOverflow