<p>I've created a cluster with <em>minikube</em> </p>

<pre><code>minikube start 
</code></pre>

<p>Applied this yaml manifest:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: gateway-deployment
spec:
  selector:
    matchLabels:
      app: gateway
  replicas: 1
  template:
    metadata:
      labels:
        app: gateway
    spec:
      containers:
      - name: gateway
        image: docker_gateway
        imagePullPolicy: Never
        ports:
        - containerPort: 4001
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: gateway
spec:
  selector:
    app: gateway
  ports:
  - protocol: TCP
    port: 4001
</code></pre>

<p>And my GO app in the container <code>docker_gateway</code> is just a gin http server with one route</p>

<pre><code>package main
import "github.com/gin-gonic/gin"

func main() {
    r := gin.Default()
    r.GET("/hello", func(c *gin.Context) {
        c.JSON(200, gin.H{
            "message": "hello",
        })
    })

    server = &amp;http.Server{
        Addr:    ":4001",
        Handler: r,
    }

    server.ListenAndServe()
}
</code></pre>

<p>In Postman I make requests to 192.168.252.130:4001/hello and get a responses</p>

<p>But Kubernetes Pod's logs in Kubernetes <em>don't print</em> those requests. I expect to get this:</p>

<pre><code>[GIN] 2019/10/25 - 14:17:20 | 200 |       1.115µs |      192.168.252.1| GET      /hello
</code></pre>

<p>But an interesting thing is <em>when I add Ingress</em></p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: ingress
spec:
  backend:
    serviceName: gateway
    servicePort: 4001
</code></pre>

<p>I am able to make requests to 192.168.252.130/hello and 192.168.252.130:4001/hello
And <em>without</em> the port Pod's logs print requests, but <em>with</em> the port - they don't.</p>

<pre><code>[GIN] 2019/10/25 - 14:19:13 | 200 |       2.433µs |      192.168.252.1| GET      /hello
</code></pre>

ligowsky
<p>It's because you cannot access a kubernetes service of <code>ClusterIP</code> type from outside(in your case, outside of minikube) of the cluster. </p>

<p>Learn more about service types <a href="https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types" rel="nofollow noreferrer">here</a></p>

<p>To access your service from outside, change your service to <code>NodePort</code> type.</p>

<p>Something like:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: gateway
spec:
  selector:
    app: gateway
  ports:
  - protocol: TCP
    nodePort: 30036
    port: 4001
  type: NodePort
</code></pre>

<p>Then you will be able to access it at <code>http://&lt;minikube-ip&gt;:30036/</code></p>
