elp
elp

Reputation: 870

Accessing nginx ingress controller on port 80

I am able to access the nginx ingress controller on the NodePort. My goal is to access the controller on port 80.

Output of kubectl -n ingress-nginx describe service/ingress-nginx

Name:                     ingress-nginx
Namespace:                ingress-nginx
Labels:                   app.kubernetes.io/name=ingress-nginx
                          app.kubernetes.io/part-of=ingress-nginx
Annotations:              kubectl.kubernetes.io/last-applied-configuration:
                            {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app.kubernetes.io/name":"ingress-nginx","app.kubernetes.io/par...
Selector:                 app.kubernetes.io/name=ingress-nginx,app.kubernetes.io/part-of=ingress-nginx
Type:                     NodePort
IP:                       10.100.48.223
Port:                     http  80/TCP
TargetPort:               80/TCP
NodePort:                 http  30734/TCP
Endpoints:                192.168.0.8:80
Port:                     https  443/TCP
TargetPort:               443/TCP
NodePort:                 https  32609/TCP
Endpoints:                192.168.0.8:443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

I have few ideas of solving that problem:

I am not sure if these are common ways to do this, so I'd love to hear how you usually deal with this. Probably there is another component necessary?

Upvotes: 3

Views: 4673

Answers (2)

Huy Chau
Huy Chau

Reputation: 2240

You should change from NodePort to LoadBalancer type for your nginx service. Example manifest look like:

spec:
  ports:
  - name: nginx
    port: 80
    protocol: TCP
    targetPort: 8000 // Your nginx port
  type: LoadBalancer

Upvotes: 0

coderanger
coderanger

Reputation: 54191

The normal way to handle this is with a LoadBalancer mode service which puts a cloud load balancer in front of the existing NodePort so that you can remap the normal ports back onto it.

Upvotes: 1

Related Questions