-
Notifications
You must be signed in to change notification settings - Fork 40.5k
Specify NodePort in "kubectl expose" command #25478
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bgrant0607 wdyt? |
We've been discussing recently that expose has too many options. If we have create service, do we need this in expose? |
I'd much prefer that On Wed, May 11, 2016 at 7:17 PM, Clayton Coleman notifications@github.com
|
I didn't know of the existence of the feature
|
I'd also like to add |
/sig cli |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@hvalls hi, how did you solve this problem? |
@charpty Actually, I didn't. I just used the declarative way, automating yml generation. |
@hvalls So besides te declarative way, there is no other way to describe a nodeport on a single command? |
you can do something like that
you can also add |
Here's how I managed to do it:
|
This doesn't seem to be well documented. How do you specify which pods you are selecting? |
Expose already offers 2 ports, one of which (port) is superfluous for nodeports since we only care about the nodePort and the targetPort. Adding one more port would really help everyone confronted with the thousands of tutorials using |
I don't think you do - that's another issue that's documented - #46191, as @mmumshad pointed out, this will not use the pods labels as selectors, instead it will assume selectors as app=myservice so generate the file and modify the selectors before creating the service |
expose already simple and very nice coz I do not need specify selectors it does that for me. But what I do not like is that coz I can't specify nodeport I need to do more jumps review labels and add selector. I wish |
Seems cumbersome to have to create a service for this imparatively, has there been a plan to add nodeport as an option to expose? |
Would be helpful to have such and option directly in expose or |
Choosing a specific nodeport is very uncommon, so there's not much demand for it. All of these CLI modes are sort of "toys". Good for kicking the tires but probably not what you want in prod. That said, I would not object to adding this to expose (with the current weird semantics), or to fixing expose to be less weird, or to fixing KEPs welcome. |
If
Service
type isNodePort
, it would be desirable to specify thenodePort
in commandkubectl expose
.Example:
kubectl expose rc example-rc --type=NodePort --port=9000 --target-port=8080 --node-port=32001
If you define a
Service
declaratively, in ayaml
file, you use the fieldspec.ports[*].nodePort
to achieve it. But, if it is not possible to create a declarativeService
, there is not a way to specify thenodePort
.The text was updated successfully, but these errors were encountered: