<p>I am trying to implement ClusterIP-Service on each of my Deployment. <strong>FYI, I am setting up kubernetes on my own server at the office (not using cloud for some reason)</strong>. Previously here are the network/infrastructure that I could think of :</p>

<pre><code>Ingress -&gt; Service -&gt; Deployment
</code></pre>

<p>I am not sure why my Ingress does not work as intended. I am using <a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx</a> as my Ingress Controller. I also applied Bare-metal Service config from <a href="https://kubernetes.github.io/ingress-nginx/deploy/" rel="nofollow noreferrer">https://kubernetes.github.io/ingress-nginx/deploy/</a></p>

<p>And below is my simple Ingress and ClusterIP like:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress-service
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - http:
        paths:
          - path: /
            backend:
              serviceName: simpleweb-service
              servicePort: 80

---
apiVersion : v1
kind : Service
metadata:
  name: simpleweb-service
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: 80
  selector:
    component: web
</code></pre>

<p>I tried accessing <code>http://&lt;server-internal-ip&gt;:80</code> but I got connection refused instead of getting routed to my apps inside the particular service. Is anything I did above could possibly gone wrong ?</p>

<p>Do I need to have <code>LoadBalancer</code> before Ingress like below ? (which one is ideal)</p>

<pre><code>LoadBalancer -&gt; Ingress -&gt; Service -&gt; Deployment
</code></pre>

<p>or maybe</p>

<pre><code>LoadBalancer -&gt; Service -&gt; Deployment
</code></pre>

<p>Thanks in advance.</p>

<p><strong>Access Options:</strong></p>

<ul>
<li>using the k8s service ( clusterIP , nodeport , loadbalancer ( in aws , gcp environement ))</li>
</ul>

<blockquote>
  <p>External load balanacer (optional) ->Service of type nodeport -> Deploymenet</p>
</blockquote>

<ul>
<li>using the ingress</li>
</ul>

<blockquote>
  <p>External load balanacer (optional) -> Ingress -> Service ( clusterIP)-> Deploymenet</p>
</blockquote>

<p>In you case , you can test it by first using the nodeport and access it directly , then if works , then use the clusterIp , and curl it inside the cluster to make sure it is running on port 80 , then expose it on ingress if you want to use ingress. Also debug and descirbe the ingress service.</p>

<p>If you are getting connection refused , there can be a problem with port.</p>

<p>Also make sure you are using the correct labels for selector.</p>

<p>docs:
<a href="https://console.bluemix.net/docs/containers/cs_ingress.html#ingress" rel="nofollow noreferrer">https://console.bluemix.net/docs/containers/cs_ingress.html#ingress</a></p>
