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

Specify NodePort in "kubectl expose" command #25478

Closed
hvalls opened this Issue May 11, 2016 · 12 comments

Comments

Projects
None yet
@hvalls

hvalls commented May 11, 2016

If Service type is NodePort, it would be desirable to specify the nodePort in command kubectl expose.

Example:
kubectl expose rc example-rc --type=NodePort --port=9000 --target-port=8080 --node-port=32001

If you define a Service declaratively, in a yaml file, you use the field spec.ports[*].nodePort to achieve it. But, if it is not possible to create a declarative Service, there is not a way to specify the nodePort.

@adohe

This comment has been minimized.

Member

adohe commented May 12, 2016

@bgrant0607 wdyt?

@smarterclayton

This comment has been minimized.

Contributor

smarterclayton commented May 12, 2016

We've been discussing recently that expose has too many options. If we have create service, do we need this in expose?

@thockin

This comment has been minimized.

Member

thockin commented May 12, 2016

I'd much prefer that create service be the place where we accumulate
flag-per-field sorts of things. Expose is supposed to be simple. That
said, this flag is not egregious to me, since there's ample precedent

On Wed, May 11, 2016 at 7:17 PM, Clayton Coleman notifications@github.com
wrote:

We've been discussing recently that expose has too many options. If we
have create service, do we need this in expose?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#25478 (comment)

@hvalls

This comment has been minimized.

hvalls commented May 12, 2016

I didn't know of the existence of the feature create service. So I'm agree with place it in kubectl create service.

I'd much prefer that create service be the place where we accumulate
flag-per-field sorts of things. Expose is supposed to be simple. That
said, this flag is not egregious to me, since there's ample precedent

@bgrant0607

This comment has been minimized.

Member

bgrant0607 commented May 12, 2016

I'd also like to add --edit to expose (and to run, create), which would allow someone to add arbitrary fields that didn't have flags. #18064

@kargakis

This comment has been minimized.

Member

kargakis commented Jun 20, 2017

/sig cli

@fejta-bot

This comment has been minimized.

fejta-bot commented Dec 29, 2017

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@fejta-bot

This comment has been minimized.

fejta-bot commented Jan 28, 2018

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten
/remove-lifecycle stale

@charpty

This comment has been minimized.

charpty commented Apr 20, 2018

@hvalls hi, how did you solve this problem?

@hvalls

This comment has been minimized.

hvalls commented Apr 20, 2018

@charpty Actually, I didn't. I just used the declarative way, automating yml generation.

@mkasep

This comment has been minimized.

mkasep commented Jul 20, 2018

@hvalls So besides te declarative way, there is no other way to describe a nodeport on a single command?

@odedpriva

This comment has been minimized.

odedpriva commented Sep 4, 2018

you can do something like that

kubectl expose deployment source-ip-app --name=nodeport --port=80 --target-port=8080 --type=NodePort  --overrides '{ "apiVersion": "v1","spec":{"ports":[{"port":80,"protocol":"TCP","targetPort":8080,"nodePort":30031}]}}'

you can also add --dry-run -o yaml to check validate the service object that will be created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment