<p>Im new to Kub and i converted my envirement from docker-compose,
I have a pod that have python code  - if i use my docker on the same host i can accsess
but when its on pod no traffic goes inside,</p>
<h1 id="kubectl-config-view-sfhv">kubectl config view</h1>
<pre><code>apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://10.10.10.130:6443
  name: kubernetes
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: REDACTED
    client-key-data: REDACTED
</code></pre>
<p>api-service.yaml:</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert --volumes hostPath
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
  labels:
    io.kompose.service: api
  name: api
spec:
  ports:
  - name: &quot;5001&quot;
    port: 5001
    targetPort: 5001
  selector:
    io.kompose.service: api
status:
  loadBalancer: {}
</code></pre>
<p>api-deployment.yaml:</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert --volumes hostPath
    kompose.version: 1.21.0 (992df58d8)
  creationTimestamp: null
  labels:
    io.kompose.service: api
  name: api
spec:
  replicas: 1
  selector:
    matchLabels:
      io.kompose.service: api
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        kompose.cmd: /snap/kompose/19/kompose-linux-amd64 convert --volumes hostPath
        kompose.version: 1.21.0 (992df58d8)
      creationTimestamp: null
      labels:
        io.kompose.service: api
    spec:
      containers:
      - image: 127.0.0.1:5000/api:latest
        imagePullPolicy: &quot;Never&quot;
        name: api
        ports:
        - containerPort: 5001
        resources: {}
        volumeMounts:
        - mountPath: /base
          name: api-hostpath0
      restartPolicy: Always
      serviceAccountName: &quot;&quot;
      volumes:
      - hostPath:
          path: /root/ansible/api/base
        name: api-hostpath0
status: {}
</code></pre>
<p>pod log:</p>
<pre><code> * Serving Flask app 'server' (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
 * Running on http://10.244.0.17:5001/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 553-272-086
</code></pre>
<p>I tried reaching what the config view shows and i get this :
<a href="https://10.10.10.130:6443/" rel="nofollow noreferrer">https://10.10.10.130:6443/</a></p>
<pre><code>{
  &quot;kind&quot;: &quot;Status&quot;,
  &quot;apiVersion&quot;: &quot;v1&quot;,
  &quot;metadata&quot;: {
    
  },
  &quot;status&quot;: &quot;Failure&quot;,
  &quot;message&quot;: &quot;forbidden: User \&quot;system:anonymous\&quot; cannot get path \&quot;/\&quot;&quot;,
  &quot;reason&quot;: &quot;Forbidden&quot;,
  &quot;details&quot;: {
    
  },
  &quot;code&quot;: 403
}
</code></pre>
<p>The path to reach through container is :
<a href="https://10.10.10.130:5001/" rel="nofollow noreferrer">https://10.10.10.130:5001/</a>
It does not reach container and says like site does not exists -
again this works on docker container so what am i missing ?</p>
<p>Thanks</p>
<p><strong>--EDIT--</strong></p>
<p>If i curl <a href="http://10.244.0.17:5001/" rel="nofollow noreferrer">http://10.244.0.17:5001/</a> (the address the api pod) from host i get in, why i cannot get in from outside?</p>
<p>Also tried adding nginx + api pod deployment</p>
<pre><code>  template:
    spec:
      hostNetwork: true
</code></pre>
<p>Still cannot reach please help</p>

Batchen Regev
<p>Found the solution!
I needed to add  <code>externalIPs</code> to my pods service.yaml (api and nginx)</p>
<pre><code>spec:
  ports:
  - name: &quot;8443&quot;
    port: 8443
    targetPort: 80
  externalIPs:
      - 10.10.10.130
</code></pre>
