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

Fix NodePort docs #461

Closed
tamalsaha opened this issue Sep 6, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@tamalsaha
Copy link
Member

commented Sep 6, 2017

https://github.com/appscode/voyager/blob/master/docs/user-guide/ingress/node-port.md

Let me clarify how it works
If you are using a NodePort or LoadBalancer (default) type Ingress, a NodePort or LoadBalancer type service is used to expose HAProxy pods.
If you specify no NodePort for each HAproxy service port, Kubernetes will randomly assign one for you.
This is how 3.1.4 worked.
in 3.2.0, we have added the option to specify a NodePort for each HAProxy service port.
This allows you to guarantee that the port will not get changed, as you make changes to the ingress.
Also, you know ahead of time which NodePort will be used.
If you specify nothing, Kubernetes will auto assign as before.


My question is based solely on the ingress resource in the above mentioned doc...
Can I specify one node-port for the whole ingress resource which includes single rules with multiple host


Yes, if those are all using the same HAProxy port.

In that example, you can't use the same NodePort
Since one is a TCP service, another one if a HTTP service
But, you use have different Hosts with the HTTP service, they are all going to use the same NodePort
In fact, you have to use the same NodePort for all rules with same HTTP port, otherwise you will get a validation error.

@tamalsaha

This comment has been minimized.

Copy link
Member Author

commented Sep 6, 2017

apiVersion: voyager.appscode.com/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  namespace: default
spec:
  rules:
  - host: appscode.example.com
    http:
      port: '8989'
      nodePort: '32666'
      paths:
      - path: /t1
        backend:
          serviceName: t1-service
          servicePort: '80'
      - path: /t2
        backend:
          serviceName: t2-service
          servicePort: '80'
  - host: other.example.com
    http:
      port: '8989'
      nodePort: '32666'
      paths:
      - backend:
          serviceName: test-service
          servicePort: '80'
  - host: appscode.example.com
    tcp:
      port: '4343'
      nodePort: '35666'
      paths:
      - backend:
          serviceName: test-service
          servicePort: '80'

Port 8989 has 2 separate hosts appscode.example.com and other.example.com . appscode.example.com has 2 paths
Since they all expose via the same HTTP port, they must use the same NodePort
If you think about the Service that will be created here, will have one service port 8989 that points to container port 8989 and uses NodePort 3266
kubectl get service voyager-test-ingress -o yaml (edited)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.