<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>

thegexploit
<p>You have a number of options to expose your service. I suggest <a href="https://metallb.universe.tf/%20%22metallb" rel="nofollow noreferrer">metallb</a>, it allows you to expose services with LoadBalancer. With ClusterIP, the service is not exposed to the outside world, see <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">Publishing services - service types</a> for details.
Ingress is not mandatory, but without it, you can only have one service+port / IP address, while ingress allows you to have name or / and path based routing.</p>
