<p>I set up a local kubernetes cluster with minikube. On my cluster I have only one deployment runnning and one service attached to it. I used a NodePort on port 30100 to expose the service, so I can access it from my browser or via curl.</p>
<p>here is the <code>python-server.yml</code> file I use to setup the cluster:</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: python-server-deployment
  namespace: kubernetes-hello-world
  labels:
    app: python-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: python-server
  template:
    metadata:
      labels:
        app: python-server
    spec:
      containers:
      - name: python-hello-world
        image: hello-world-python:latest
        imagePullPolicy: Never
        ports:
        - containerPort: 5000
---
apiVersion: v1
kind: Service
metadata:
  name: python-server-internal-service
  namespace: kubernetes-hello-world
spec:
  type: NodePort
  selector:
    app: python-server
  ports:
    - protocol: TCP
      port: 80
      targetPort: 5000
      nodePort: 30100
</code></pre>
<p>my <code>python-hello-world</code> image is based on this python file:</p>

<pre class="lang-py prettyprint-override"><code>from http.server import BaseHTTPRequestHandler, HTTPServer


class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        html = &quot;&quot;&quot;
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Hello World&lt;/title&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;h1&gt;Hello World&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
        &quot;&quot;&quot;
        self.send_response(200)
        self.send_header('Access-Control-Allow-Origin', '*')
        self.send_header('Content-type', 'text/html')
        self.end_headers()
        self.wfile.write(bytes(html, &quot;utf-8&quot;))
    

def run():
    addr = ('', 5000)
    httpd = HTTPServer(addr, MyServer)
    httpd.serve_forever()


if __name__ == '__main__':
    run()
</code></pre>
<p>When I run the cluster I can as expected receive the hello world html with <code>curl {node_ip}:30100</code>. But when I try to access my service via my browser with the same ip:port I get a time out.
I read that that can be caused by missing headers but I think I have all necessary ones covered in my python file, so what else could cause this?</p>

Cake
<p>It is not said that you reach the IP of your node (you should provide some more information about the environment if necessary).</p>
<p>But you could port forward the service and reach it easily.</p>
<p>Take a look here:
<a href="https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/</a></p>
<p>Some other doc:
<a href="https://stackoverflow.com/questions/51468491/how-kubectl-port-forward-works">How kubectl port-forward works?</a></p>
