<p>I set up a trivial kubernetes yaml file (below) to test the nginx ingress. Nginx works as expected inside the cluster but isn't visible outside the cluster.</p>
<p>I'm running <code>minikube</code> with <code>minikube tunnel</code> and <code>minikube addons enable ingress</code>. When I <code>kubectl exec</code> into the <code>nginx-controller</code> I can see nginx working and serving up the test page, but when I try to hit it from outside I get <code>Failed to connect to 127.0.0.1 port 80: Connection refused</code>.</p>
<p>Save the following yaml as <code>stackoverflow.yaml</code></p>
<pre><code>kind: Deployment
apiVersion: apps/v1
metadata:
  name: cheese-app
  labels:
    app: cheese-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cheese-app
  template:
    metadata:
      labels:
        app: cheese-app
    spec:
      containers:
      - name: cheese-container
        image: errm/cheese:stilton
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: cheese-svc
spec:
  selector:
    app: cheese-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cheese-ingress
spec:
  rules:
  - http:
      paths:
      - path: /
        backend:
          serviceName: cheese-svc
          servicePort: 80
</code></pre>
<p>Then initialize minikube</p>
<pre><code>minikube start
minikube addons enable ingress
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-system ingress-nginx/ingress-nginx
kubectl wait --for=condition=ready pod --all --timeout=120s
kubectl get pods
</code></pre>
<p>Start a minikube tunnel in another terminal window</p>
<pre><code>minikube tunnel
</code></pre>
<p>And apply the yaml file</p>
<pre><code>kubectl apply -f ./stackoverflow.yaml
kubectl wait --for=condition=ready pod --all --timeout=120s
kubectl get pods
kubectl get svc
</code></pre>
<p>For reference, my pods and svc are</p>
<pre><code>NAME                                                       READY   STATUS    RESTARTS   AGE
cheese-app-74ddc9f7c6-xpjwx                                1/1     Running   0          89m
ingress-system-ingress-nginx-controller-656bf75d85-fkzzp   1/1     Running   0          90m

cheese-svc                                          ClusterIP      10.104.243.39   &lt;none&gt;        80/TCP                       82m
ingress-system-ingress-nginx-controller             LoadBalancer   10.106.203.73   127.0.0.1     80:30635/TCP,443:32594/TCP   83m
ingress-system-ingress-nginx-controller-admission   ClusterIP      10.101.103.74   &lt;none&gt;        443/TCP                      83m
kubernetes                                          ClusterIP      10.96.0.1       &lt;none&gt;        443/TCP                      84m
</code></pre>
<p>At this point <code>curl 127.0.0.1/</code> should theoretically return a sample web page, but instead it reports <code>connection refused</code>.</p>
<p>As a diagnostic step, I tried using <code>kubectl exec</code> to try to curl the page from the nginx server from inside the cluster. That works as long as I curl nginx using its own <code>127.0.0.1</code> endpoint. If I curl it using its CLUSTER-IP (<code>10.106.203.73</code> in this cluster), I get nothing.</p>
<pre><code>kubectl exec --stdin --tty ingress-system-ingress-nginx-controller-656bf75d85-fkzzp -- curl 127.0.0.1/ -i
...works...

kubectl exec --stdin --tty ingress-system-ingress-nginx-controller-656bf75d85-fkzzp -- curl 10.106.203.73/ -i
...nothing...

curl 127.0.0.1/
...nothing...
</code></pre>
<p>I haven't modified the <code>/etc/nginx/nginx.conf</code> in any way, it's the default config auto generated by setting up the kubernetes ingress.</p>

Don Alvarez
<p>From within cluster this link should work - http://.:port
in your case it will be - <a href="http://cheese-svc.default:80" rel="nofollow noreferrer">http://cheese-svc.default:80</a></p>
<p>To access it from outside, the service is accessible on nodePort 30635
<a href="http://10.106.203.73:30635" rel="nofollow noreferrer">http://10.106.203.73:30635</a></p>
