Is Ingress useable only for Minikube? It is not working in Ubuntu installation

4/28/2019

I tested ingress in minikube successfully, no issue at all. Then I deployed my app into ubuntu, if I am using service NodePort, it is also worked very well. After that, I was thinking to use Ingress as load balancer to router traffic, so that external url is no longer the ugly long port. But unfortunately, I did not succeed, always failed.

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
    name: dv
    annotations:
        ingress.kubernetes.io/rewrite-target: /
spec:
    rules:
    - http:
          paths:
          - path: /test
            backend:
                serviceName: ngsc
                servicePort: 3000

kubectl get ing
NAME   HOSTS   ADDRESS   PORTS   AGE
dv     *                 80      12s
root@kmaster:/home/ubuntu/datavisor# kubectl describe ing dv
Name:             dv
Namespace:        default
Address:          
Default backend:  default-http-backend:80 (<none>)
Rules:
  Host  Path  Backends
  ----  ----  --------
  *     
        /   ngsc:3000 (192.168.1.14:3000,192.168.1.17:3000,192.168.1.18:3000)
Annotations:
  ingress.kubernetes.io/rewrite-target:  /
Events:                                  <none>

Then when I tried to access, I got following error:

curl http://cluster-ip
curl: (7) Failed to connect to <cluster-ip> port 80: Connection refused

What I really hope is to let the url exposed outside is http://ipaddress, instead of http://ipaddress:30080

I know that I can easily use nginx out of kubernete to meet this requirement, but that is not ideal, I want kubernete to handle it so that even service port changed, everything is still up.

Can you check above output and tell me what is the error? I checked a lot doc, every place seemed focus only in minikube, nothing related to real cluster deployment. Do I need to install anything to make ingress working? when I use kubectl get all --all-namespaces I did not see the ingress-controller installed at all. How can I install it if needed?

Thanks for your advice

-- user3006967
kubernetes
kubernetes-ingress
nginx-ingress

1 Answer

4/28/2019

Well, actually Kubernetes does not provide any Ingress controller out of box. You have to install Nginx Ingress or Traefik Ingress or anything else. Ingress controller must run somewhere in your cluster, it's a must. Actually ingress controller is the actual proxy that proxies traffic to your applications.

And I think you should know that minikube under the hood also uses nginx-ingress-controller (see https://github.com/kubernetes/minikube/tree/master/deploy/addons/ingress).

In a cloud environments ingress controllers run behind the cloud load balancer that performs load balancing between cluster nodes.

If you run on-prem cluster - then usually your ingress-controller is run as NodePort service and you may create DNS record pointing to your node IP addresses. It is also possible to run ingress controller on dedicated nodes and use hostNetwork: true. That will allow to use standard 80/443 ports. So there are many options here.

-- Vasily Angapov
Source: StackOverflow