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

service type=NodePort doesn't work in non-standard port range (even with apiserver configuration) #1006

Closed
notmaxx opened this issue Jan 14, 2017 · 5 comments
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@notmaxx
Copy link

notmaxx commented Jan 14, 2017

BUG REPORT

Minikube version: v0.15.0

Environment:

  • OS: OS X El Captain, Version: 10.11.6 (15G1212)
  • VM Driver: xhyve
  • Docker version: 1.12.6, build 78d1802
  • Install tools: curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.15.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
  • Others:

What happened:
Issue is similar to #836 but doesn't work for me

I receive error when start service on ports other than 30000-32767:
The Service "http-service" is invalid: spec.ports[0].nodePort: Invalid value: 3000: provided port is not in the valid range. The range of valid ports is 30000-32767

Even with apiserver port range configured during minikube start

minikube start --extra-config=apiserver.GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange=1000-10000
Starting local Kubernetes cluster...
Kubectl is now configured to use the cluster.

What you expected to happen:
I expect my "http-service" service would be created successfully & I can use my rails app running in pod in minikube on port 3000

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

minikube start --extra-config=apiserver.GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange=1000-10000
kubectl create -f web-service.json

Anything else do we need to know:

Here is my web-service.json

{
  "kind": "Service",
  "apiVersion": "v1",
  "metadata": {
    "name": "http-service"
  },
  "spec": {
    "type": "NodePort",
    "ports": [
      {
        "name": "http",
        "protocol": "TCP",
        "port": 3000,
        "targetPort": 3000,
        "nodePort": 3000
      },
      {
        "name": "http-webpack",
        "protocol": "TCP",
        "port": 3010,
        "targetPort": 3010,
        "nodePort": 3010
      },
      {
        "name": "test-nginx",
        "protocol": "TCP",
        "port": 80,
        "targetPort": 8080,
        "nodePort": 8080
      }
    ],
    "selector": {
      "name": "http-service"
    }
  }
}
@r2d4 r2d4 added the kind/bug Categorizes issue or PR as related to a bug. label Jan 14, 2017
@notmaxx
Copy link
Author

notmaxx commented Jan 16, 2017

Right now I use socat as workaround (in case someone has similar problems)

# in my current config I map http & http-webpack to ports 31000 & 31010 
socat TCP-LISTEN:3010,fork TCP:192.168.64.4:31010 & 
socat TCP-LISTEN:3000,fork TCP:192.168.64.4:31000 & 

@r2d4
Copy link
Contributor

r2d4 commented Jan 19, 2017

Can you show the output of minikube logs | grep ServiceNodePortRange

@notmaxx
Copy link
Author

notmaxx commented Jan 20, 2017

hi @r2d4

here you go, seems my error is similar to discussion in #836, people posted similar logs there

 ap$ minikube logs | grep ServiceNodePortRange
Jan 20 19:50:27 minikube localkube[2691]: I0120 19:50:27.159478    2691 localkube.go:117] Setting GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1000-10000 on apiserver.
Jan 20 19:50:27 minikube localkube[2691]: W0120 19:50:27.159490    2691 localkube.go:119] Unable to set GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1000-10000. Error: Unable to find field by name: ServerRunOptions
Jan 20 19:50:27 minikube localkube[2691]: I0120 19:50:27.159495    2691 localkube.go:117] Setting GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1000-10000 on apiserver.
Jan 20 19:50:27 minikube localkube[2691]: W0120 19:50:27.159499    2691 localkube.go:119] Unable to set GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange to 1000-10000. Error: Unable to find field by name: ServerRunOptions

@r2d4
Copy link
Contributor

r2d4 commented Jan 20, 2017

Your issue is that you're not using the correct path for ServiceNodePortRange, it should be

$ minikube start --extra-config=apiserver.GenericServerRunOptions.ServiceNodePortRange=1000-10000
$ minikube logs | grep ServiceNodePortRange
 
Jan 20 20:45:51 minikube localkube[12296]: I0120 20:45:51.238465   12296 localkube.go:117] Setting GenericServerRunOptions.ServiceNodePortRange to 1000-10000 on apiserver.

i.e. apiserver.GenericServerRunOptions.ServerRunOptions.ServiceNodePortRange=1000-10000

@notmaxx
Copy link
Author

notmaxx commented Jan 20, 2017

@r2d4 thank you

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

2 participants