Skip to content
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

how can I allocate my service (type=NodePort) on nodePort: 80 #836

Closed
dani8art opened this issue Nov 22, 2016 · 9 comments
Closed

how can I allocate my service (type=NodePort) on nodePort: 80 #836

dani8art opened this issue Nov 22, 2016 · 9 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@dani8art
Copy link

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
Feature request

Minikube version (use minikube version): v0.12.2

Environment:

  • OS : windows
  • VM Driver : virtualbox
  • Docker version (e.g. docker -v): Docker version 1.11.1, build 5604cbe
  • Install tools:
  • Others:

What happened:

When I create a service (type=NodePort) and I want to allocate it to port 80 or 27017, kubectl responds:

The Service "pets-service" is invalid. spec.ports[0].nodePort: Invalid value: 80: provided port is not in the valid range

I've seem the documentation and I think that you can change some parameters on minikube start with --extra-config and in other issues that I could see say that I must change the ServiceNodePortRange. I've tried to execute:

minikube start --extra-config=apiserver.GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange=1-30000

but this doesn't work.

I kwon I can set nodePort to other port in the range 30000-31000, but this solution isn't good for me.

any hint?

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Run minikube

minikube start

Create service

kubectl create -f pets-service.yaml

Anything else do we need to know:

My service file:

apiVersion: v1
kind: Service
metadata:
 name: pets-service
 labels:
   name: pets-service
spec:
 type: NodePort
 ports:
   - port: 80
     targetPort: 80
     nodePort: 80
     protocol: TCP
 selector:
   name: pets-service
@dlorenc
Copy link
Contributor

dlorenc commented Nov 22, 2016

Hey,

Looks like Port Range uses a custom type and parser. We have to add that to the extra-config parsing. I just sent #837 to do that, then you should be good to go :)

@r2d4 r2d4 added the kind/bug Categorizes issue or PR as related to a bug. label Nov 22, 2016
@dani8art
Copy link
Author

Thank you but the error persits:

I1122 19:09:44.237214    2969 localkube.go:116] Setting GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1-30000 on apiserver.
W1122 19:09:44.237283    2969 localkube.go:118] Unable to set GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1-30000. Error: Unable to find field by name: GenericServerRunOptions
I1122 19:09:44.237290    2969 localkube.go:116] Setting GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1-30000 on apiserver.
W1122 19:09:44.237297    2969 localkube.go:118] Unable to set GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1-30000. Error: Unable to find field by name: GenericServerRunOptions

I send you logs outputs for checking.

What is good string for it works?

@r2d4
Copy link
Contributor

r2d4 commented Nov 22, 2016

@dani8art You'll need to make sure you're consulting the right version of the k8s type. This struct changed between 1.4 and 1.5. You can check to see what version your minikube is running with kubectl version and looking at the server version.

This is the name of the struct for kubernetes 1.4.6, looks like the path would be api.ServerRunOptions.ServiceNodePortRange

https://github.com/kubernetes/kubernetes/blob/v1.4.6/cmd/kube-apiserver/app/options/options.go#L34

@dani8art
Copy link
Author

Hi,

I've downloaded the latest build version of minikube from:

https://storage.googleapis.com/minikube-builds/837/minikube-windows-amd64.exe

and I've executed:

minikube start --extra-config=apiserver.ServerRunOptions.ServiceNodePortRange=1-30000

I think is the build version with the changes that resolves this bug #836 and now the error is different it says:

I1122 23:26:25.916788    2846 localkube.go:116] Setting ServerRunOptions.ServiceNodePortRange to 1-30000 on apiserver.

W1122 23:26:25.916865    2846 localkube.go:118] Unable to set ServerRunOptions.ServiceNodePortRange to 1-30000. Error: Unable to set type 30000-32767.
I1122 23:26:25.916873    2846 localkube.go:116] Setting ServerRunOptions.ServiceNodePortRange to 1-30000 on apiserver.

W1122 23:26:25.916882    2846 localkube.go:118] Unable to set ServerRunOptions.ServiceNodePortRange to 1-30000. Error: Unable to set type 30000-32767.

have I downloaded the good version of minikube?

@dlorenc
Copy link
Contributor

dlorenc commented Nov 23, 2016

I'll try this out now.

@dlorenc
Copy link
Contributor

dlorenc commented Nov 23, 2016

Whoops, I figured out the issue. It was the last swap of imports. The types aren't the same:

utilnet "k8s.io/kubernetes/pkg/util/net"
vs.
utilnet "k8s.io/client-go/1.4/pkg/util/net"

@dani8art
Copy link
Author

That good, now it is working!
Thank you so much!

@dlorenc dlorenc closed this as completed Nov 28, 2016
@dlorenc
Copy link
Contributor

dlorenc commented Nov 28, 2016

Great! We'll try to get a release out this week.

@gsaslis
Copy link

gsaslis commented Apr 29, 2018

seems like the option has changed these days.
#2765 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants