0
votes

I've got two services running on a minikube setup with one nested VM and a virtualbox driver.

The services are exposed on their own ports let's say 30000 and 30001.

These ports are opened up in the azure portal and also added to the virtualbox NAT with

vboxmanage controlvm minikube natpf1 "port30000,tcp,,30000,,30000"

Calling the services from outside the cluster works now: http://50.50.50.50:32000

Now to take it one step further an ingress controller is added to the services where /http1 goes to one service and http2 to the other.

apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
  name: http-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
  rules:
  - host: laurijssen.local
    http:
      paths:
      - path: /http1
        backend:
          serviceName: http-deployment1
          servicePort: 8080
      - path: /http2
        backend:
          serviceName: http-deployment2
          servicePort: 8080

laurijssen.local is added to /etc/hosts with the minikube VM's ip address, this is not used for the rest. port80 is opened up on the azure portal and added to virtualbox NAT list.

The services are type NodePort and called http-deployment1 and 2

http-deployment1   NodePort    10.104.217.239   <none>        8080:30000/TCP   25m
http-deployment2   NodePort    10.107.168.29    <none>        8080:30001/TCP   25m

But it just does not work, calling the service from outside the cluster over port 80 gives a timeout.

What else is needed to get services called from outside over ingress working?

edit

The logs of the ingress-controller pod:

I0716 main.go:115] successfully validated configuration, accepting ingress http-ingress in namespace default

I0716 event.go:278] Event(v1.ObjectReference{Kind:"Ingress", Namespace:"default", Name:"http-ingress", UID:"a0", APIVersion:"/v1beta1", ResourceVersion:"2601", FieldPath:""}): type: 'Normal' reason: 'UPDATE' Ingress default/http-ingress

I0716 controller.go:139] Configuration changes detected, backend reload required.

edit

Port 80 seems to be closed on the host, could that be the problem or is that handled by the NAT module?

nmap -v localhost -Pn -p 80

Scanning localhost (127.0.0.1) [1 port] Completed Connect Scan at 11:00, 0.00s elapsed (1 total ports) Nmap scan report for localhost (127.0.0.1) Host is up (0.00015s latency).

PORT STATE SERVICE 80/tcp closed http

I0716 controller.go:155] Backend successfully reloaded. Are there any logs to check to see what's going on?

1
add logs from ingress controller podArghya Sadhu
ok, logs edited inServe Laurijssen

1 Answers

1
votes

Try to run nginx ingress controller using hostNetwork:true my editing the deployment. This way nginx will directly listen on port 80 on host's network and you should be able reach to it via http://laurijssen.local/http1