Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow a range of ports in Kubernetes in containerPort variable?

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?

like image 436
Aditya Patawari Avatar asked Feb 15 '16 12:02

Aditya Patawari


1 Answers

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.

like image 167
Antoine Cotten Avatar answered Oct 14 '22 05:10

Antoine Cotten