<p>The service is external-ip is  and is unable to bind with a external port. I have run the command to try to find the port.</p>
<blockquote>
<p>minikube service mongodb-express-service</p>
</blockquote>
<p>There is no error shown on the terminal. But the browser says that it is unable to connect to that url.</p>
<p><strong>Enviroment</strong></p>
<ul>
<li>Minikube</li>
<li>Oracle Virtual Box</li>
<li>Ubuntu 20.04</li>
</ul>
<p><strong>mongo-express.yaml</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: mongo-express
  labels:
    app: mongo-express
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mongo-express
  template:
    metadata:
      labels:
        app: mongo-express
    spec:
      containers:
        - name: mongo-express
          image: mongo-express
          ports:
            - containerPort: 8081
          env:
            - name: ME_CONFIG_MONGODB_ADMINUSERNAME
              valueFrom:
                secretKeyRef:
                  name: mongodb-secret
                  key: username
            - name: ME_CONFIG_MONGODB_ADMINPASSWORD
              valueFrom:
                secretKeyRef:
                  name: mongodb-secret
                  key: password
            - name: ME_CONFIG_MONGODB_SERVER
              valueFrom:
                configMapKeyRef:
                  name: mongodb-config-map
                  key: database_url
---
apiVersion: v1
kind: Service
metadata:
  name: mongodb-express-service
spec:
  selector:
    app: mongodb-express-service
  type: LoadBalancer
  ports:
    - protocol: TCP
      port: 8081
      targetPort: 8081
      nodePort: 30001
</code></pre>
<p><strong>Update</strong>
<strong>Kubectl get service output</strong></p>
<pre><code>NAME                      TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
kubernetes                ClusterIP      10.96.0.1        &lt;none&gt;        443/TCP          14d
mongodb-express-service   LoadBalancer   10.106.190.5     &lt;pending&gt;     8081:30001/TCP   2d3h
mongodb-service           ClusterIP      10.110.241.194   &lt;none&gt;        27017/TCP        3d23h
</code></pre>
<p><strong>Kubectl get pod output</strong></p>
<pre><code>mongo-express-85bdd6688f-mhv2x        1/1     Running   2          2d3h
mongodb-deployment-7f79c5f88f-h9dvf   1/1     Running   2          2d3h
</code></pre>

<p>Posting this answer to give more reference on 2 topics:</p>
<ul>
<li>Kubernetes Service not able to get External IP</li>
<li>Issue that was present in this question</li>
</ul>
<hr />
<h3>Kubernetes Service not able to get External IP</h3>
<p><code>Service</code> of type <code>LoadBalancer</code>:</p>
<blockquote>
<p>Exposes the Service externally <strong>using a cloud provider's load balancer</strong>. <code>NodePort</code> and <code>ClusterIP</code> Services, to which the external load balancer routes, are automatically created.</p>
</blockquote>
<p>In a Kubernetes solution like <code>minikube</code> you won't get out of the box <code>External IP</code> that is associated with <code>Service</code> of type <code>LoadBalancer</code>. You don't need the <code>External IP</code> to connect to your <code>Services</code>. You can connect to your <code>Services</code> by <strong>either</strong>:</p>
<ul>
<li>Using a <code>NodePort</code> (<code>$ minikube service xyz</code> is using it)</li>
<li>Using a <code>$ minikube tunnel</code> (this would &quot;assign&quot; <code>External IP</code>'s)</li>
<li><code>Virtualbox</code> specific:
<ul>
<li>Use <code>metallb</code> (<a href="https://metallb.universe.tf/" rel="nofollow noreferrer">load-balancer implementation for bare metal Kubernetes clusters</a>) to allocate the range for your <code>LoadBalancers</code> from a subnet that Host-only networking adapter uses with <code>minikube</code>.</li>
</ul>
</li>
</ul>
<hr />
<h3>Issue that was present in this question</h3>
<p>The issue that was present in the question was connected with the mismatch between the <code>Service</code> <code>.spec.selector</code> and <code>Deployment</code> <code>.spec.selector.matchLabels</code>.</p>
<p>The easiest way to check if your <code>selector</code> is configured correctly (apart from looking at the <code>YAML</code> manifest), is by:</p>
<ul>
<li><code>$ kubectl get endpoints</code></li>
</ul>
<pre class="lang-sh prettyprint-override"><code>NAME         ENDPOINTS                AGE
kubernetes   A.B.C.D:443              28m
nginx    --&gt; 10.32.0.13:80 &lt;--        5s 
</code></pre>
<blockquote>
<p>Disclaimer!</p>
<p>The <code>endpoint</code> will be present when <code>Pod</code> is in <code>Running</code> state and <code>Ready</code>.</p>
</blockquote>
<p>If the <code>nginx</code> (<code>Service</code> name) <code>endpoints</code> was empty it could mean a mismatched selector or issue with the <code>Pod</code> (<code>CrashLoopBackOff</code>, <code>Pending</code>, etc.).</p>
<p>You can also check this by:</p>
<ul>
<li><code>$ kubectl describe svc SERVICE_NAME</code> &lt;-- <code>Endpoints</code> field</li>
<li><code>$ kubectl describe endpoints SERVICE_NAME</code> &lt;-- <code>Subsets.addresses</code> field</li>
</ul>
<hr />
<p>Additional resources:</p>
<ul>
<li><em><a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">Kubernetes.io: Docs: Concepts: Services networking: Service</a></em></li>
<li><em><a href="https://minikube.sigs.k8s.io/docs/handbook/accessing/" rel="nofollow noreferrer">Minikube.sigs.k8s.io: Docs: Handbook: Accessing</a></em></li>
</ul>
