Set service-node-port-range in Google Kubernetes Engine

958 views
Skip to first unread message

Phạm Huy Hoàng

unread,
Sep 14, 2018, 11:27:36 AM9/14/18
to Kubernetes user discussion and Q&A

For our use-case, we need to access a lot of services via NodePort. By default, the NodePort range is 30000-32767. With kubeadm, I can set the port range via --service-node-port-range flag.

We are using Google Kubernetes Engine (GKE) cluster. How can I set the port range for a GKE cluster?

Tim Hockin

unread,
Sep 14, 2018, 11:46:24 AM9/14/18
to Kubernetes user discussion and Q&A
We do not expose that as a parameter today. We can discuss the
options here, but there's not short answer. Can you talk about what
you're doing to need so many node ports?
On Fri, Sep 14, 2018 at 8:27 AM Phạm Huy Hoàng <huyho...@gmail.com> wrote:
>
> For our use-case, we need to access a lot of services via NodePort. By default, the NodePort range is 30000-32767. With kubeadm, I can set the port range via --service-node-port-range flag.
>
> We are using Google Kubernetes Engine (GKE) cluster. How can I set the port range for a GKE cluster?
>
> --
> You received this message because you are subscribed to the Google Groups "Kubernetes user discussion and Q&A" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kubernetes-use...@googlegroups.com.
> To post to this group, send email to kubernet...@googlegroups.com.
> Visit this group at https://groups.google.com/group/kubernetes-users.
> For more options, visit https://groups.google.com/d/optout.

Phạm Huy Hoàng

unread,
Sep 16, 2018, 9:30:37 PM9/16/18
to Kubernetes user discussion and Q&A
Hi Tim,

Thanks for your reply. I'll explain our uses case below.

Our uses case is that we provide a service as a Linux VM so that user can SSH and VNC into that VM.
Each VM is run as a stateful set in GKE cluster. 

For each user, we need to provide expose 2 ports via a service (1 for VNC and one for SSH). 
We do not use LoadBalancer service, because the price of 1 forwarding rule is ~4-6 USD, that will increase our cost per user to 4-6USD/month.
Therefore, we use nodePort service. Because the port range is 30000-32767, it means 1 cluster can only serve about ~1400 users. Currently, our user base is ~500 so it might not be a problem, but it might be in the future.

My naive solution is to increase the port range so a cluster might be able to serve more users. If the number of users becomes big enough, maybe we can consider creating another cluster.

Thanks.

Tim Hockin

unread,
Sep 16, 2018, 11:48:09 PM9/16/18
to Kubernetes user discussion and Q&A
Hmm, this is a bit of a stretch for NodePorts. Why not use a HostPort
and update DNS dynamically if/when their VM updates?

Phạm Huy Hoàng

unread,
Sep 17, 2018, 12:24:29 AM9/17/18
to Kubernetes user discussion and Q&A
Sound like a potential solution. Thank Tim, we will try this approach to see if it works for our case.
Reply all
Reply to author
Forward
0 new messages