Skip to content

Commit

Permalink
Expose a range of ports to the host for NodePort services
Browse files Browse the repository at this point in the history
  • Loading branch information
Nail Islamov committed Nov 11, 2018
1 parent 511271b commit 99c4505
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cluster/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ func createControlPlaneNode(name, image, clusterLabel string) (handle *nodeHandl
// publish selected port for the API server
"--expose", fmt.Sprintf("%d", port),
"-p", fmt.Sprintf("%d:%d", port, port),
// publish a range of ports to be used for NodePort in services
"--expose", "30900-30999",
"-p", "30900-30999:30900-30999",
// explicitly set the entrypoint
"--entrypoint=/usr/local/bin/entrypoint",
},
Expand Down

2 comments on commit 99c4505

@zoobab
Copy link

@zoobab zoobab commented on 99c4505 Dec 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to create a NodePort:

$ kubectl expose deployment mynginx2 --type=NodePort --port=80
$ kubectl get svc
NAME         TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP   10.96.0.1      <none>        443/TCP        20m
mynginx2     NodePort    10.97.117.42   <none>        80:32093/TCP   6m

What is your reasoning for exposing this limited range "30900-30999", and not the default: "30000-32767" ? See https://kubernetes.io/docs/concepts/services-networking/service/

@nilebox
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zoobab No reason, this is just an example. Didn't know Kubernetes had a default range.

Please sign in to comment.