<p>I have following configuration of a service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: academy-backend-service
spec:
  selector:
    app: academy-backend-app
  type: NodePort
  ports:
    - port: 8081
      targetPort: 8081
      nodePort: 30081
</code></pre>
<p>Behind this service there is a deployment that runs a docker image of a spring boot application that expose port 8081.
When I try to reach the application from browser on http://localhost:30081 I don't get anything (not reachable). However if I connect inside minikube cluster, the application is available on http:{servcieip}:8081.
Any clues what is not configured properly? I thought that nodePort is enough.</p>
<pre><code>NAME                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
academy-backend-service   NodePort    10.97.44.87      &lt;none&gt;        8081:30081/TCP   34m
</code></pre>

<p>Use <code>NodePorts</code> to expose the service nodePort on all nodes in the cluster.</p>
<p>From <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a></p>
<blockquote>
<p>NodePort: Exposes the Service on each Node's IP at a static port (the NodePort). To make the node port available, Kubernetes sets up a cluster IP address, the same as if you had requested a Service of type: ClusterIP.</p>
</blockquote>
<p>If you want to expose your service outside the cluster, use <code>LoadBalancer</code> type:</p>
<blockquote>
<p>LoadBalancer: Exposes the Service externally using a cloud provider's load balancer.</p>
</blockquote>
<p>or use ingress-controller which is a reverse-proxy that routs traffics from outside to your cluster:
<a href="https://github.com/kubernetes/ingress-nginx" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx</a></p>
