<p>I'm learning Kubernetes over Minikube.
My demo consists of a Flask API and a MySQL Database.
I made all the <em>.yaml</em> files but something strange happens with services of the deployments...</p>
<p>I cannot communicate with the API <strong>externally</strong> (neither with Postman, Curl, browser...)</p>
<p>By &quot;externally&quot; I mean &quot;from outside the cluster&quot; (on the same machine, ex: from the browser, postman...)</p>
<p><strong>This the Deployment+Service for the API:</strong></p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: api-dip-api-deployment
  labels:
    app: api-dip-api
spec:
  replicas: 1
  selector:
    matchLabels:
      app: api-dip-api
  template:
    metadata:
      labels:
        app: api-dip-api
    spec:
      containers:
      - name: api-dip-api
        image: myregistry.com
        ports:
        - containerPort: 5000

        env:
        - name: DATABASE_USER
          valueFrom:
            secretKeyRef:
              name: api-secret
              key: api-db-user 

        - name: DATABASE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: api-secret
              key: api-db-password
            
        - name: DATABASE_HOST
          valueFrom:
            configMapKeyRef:
              name: api-configmap
              key: api-database-url

        - name: DATABASE_NAME
          valueFrom:
            configMapKeyRef:
              name: api-configmap
              key: api-database-name

        - name: DATABASE_PORT
          valueFrom:
            configMapKeyRef:
              name: api-configmap
              key: api-database-port           
      
      imagePullSecrets:
      - name: regcred
--- 
apiVersion: v1
kind: Service
metadata: 
  name: api-service
spec: 
  selector:
    app: api-dip-api

  ports:
  - port: 5000 
    protocol: TCP
    targetPort: 5000
    nodePort: 30000

  type: LoadBalancer
</code></pre>
<p><strong>Dockerfile API:</strong></p>
<pre><code>FROM python:latest

# create a dir for app
WORKDIR /app

# intall dependecies
COPY requirements.txt .
RUN pip install -r requirements.txt

# source code
COPY /app .

EXPOSE 5000
# run the application
CMD [&quot;python&quot;, &quot;main.py&quot;]
</code></pre>
<p>Since i'm using Minikube the correct IP for the service is displayed with</p>
<pre><code>minikube service &lt;service_name&gt;
</code></pre>
<p>I already tried looking the minikube context, as suggested in another post, but it shows like:</p>
<pre><code>CURRENT   NAME       CLUSTER    AUTHINFO   NAMESPACE
*         minikube   minikube   minikube   default
</code></pre>
<p>so it should be ok.</p>
<p>I don't know what to try now... the ports are mapped correctly I think.</p>

ANTONELLO BARBONE
<p>I <strong>did not</strong> found any solution to my problem.
I run Kubernetes with Minikube on Vmware Fusion on my Mac with BigSur.</p>
<p>I found out that the SAME EXACT deployment works on a machine with ubuntu installed, OR on a virtual machine made with VirtualBox.</p>
<p>Actually seems that this is a known issue:</p>
<ul>
<li><a href="https://github.com/kubernetes/minikube/issues/11577" rel="nofollow noreferrer">https://github.com/kubernetes/minikube/issues/11577</a></li>
<li><a href="https://github.com/kubernetes/minikube/issues/11193" rel="nofollow noreferrer">https://github.com/kubernetes/minikube/issues/11193</a></li>
<li><a href="https://github.com/kubernetes/minikube/issues/4027" rel="nofollow noreferrer">https://github.com/kubernetes/minikube/issues/4027</a></li>
</ul>
