<p>I have a cloud instance up &amp; running, I installed <code>minikube</code> on it and created a cluster, single <code>Pod</code> with <code>NodePort</code> service.</p>
<p>I know that this is not the best practice while setup <code>kubernetes</code> cluster</p>
<p><strong>The issue is</strong> :
Everything works fine if tested from inside the host machine (the cloud instance) but I am trying to reach the cluster from outside the machine using it's <code>external-ip</code> address, how to do that?</p>
<p>Deployment: the image is public if you want to test</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: python-app-deployment
spec:
  template:
    metadata:
      labels:
        tag: pythonapp
    spec:
      containers:
        - name: pythonapp
          image: atefhares/mypythonapp:latest
          ports:
            - containerPort: 8000
          env:
            - name: ENVIRONMENT
              value: DEV
            - name: HOST
              value: &quot;localhost&quot;
            - name: PORT
              value: &quot;8000&quot;
            - name: REDIS_HOST
              value: &quot;redis-service&quot;
            - name: REDIS_PORT
              value: &quot;6379&quot;
            - name: REDIS_DB
              value: &quot;0&quot;
  replicas: 1
  selector:
    matchLabels:
      tag: pythonapp
</code></pre>
<p>Service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: python-app-service
spec:
  type: NodePort
  ports:
    - nodePort: 30001
      port: 8000
  selector:
    tag: pythonapp
</code></pre>
<p>Database deployment:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
spec:
  template:
    metadata:
      labels:
        name: redis
    spec:
      containers:
        - name: redis
          image: redis:latest
          ports:
            - containerPort: 6379
  selector:
      matchLabels:
        name: redis
</code></pre>
<p>Database service:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: redis-service
spec:
  ports:
  - port: 6379
    protocol: TCP
  selector:
    name: redis
</code></pre>

Atef Hares
<p>The issue is because <code>minkube</code> creates a <code>VM</code> or a <code>docker container</code> to be used as worker/node. that's why the cluster is not by default accessible from outside the machine.</p>
<p>To fix this issue use <code>minikube</code> without <code>drivers</code> as follows:</p>
<pre><code>sudo minikube start --driver=none
</code></pre>
<p>This will enforce <code>minikube</code> to not create any <code>VMs</code> or <code>Containers</code> and will directly use resources from the host.</p>
<p>Also, make sure everything works fine in your <code>deployment</code> and you will be able to access the cluster using the machine's <code>external-ip</code> address and <code>service</code> port.</p>
<p>Know more <a href="https://minikube.sigs.k8s.io/docs/drivers/none/" rel="nofollow noreferrer">here</a></p>
<hr />
<p><strong>PS</strong>: This is not a setup for production environments!</p>
