<p>Here is a manifest file for minikube Kubernetes, for a deployment and a service:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-deployment
spec:
  selector:
    matchLabels:
      app: hello
  replicas: 3
  template:
    metadata:
      labels:
        app: hello
    spec:
      containers:
      - name: hello
        image: hello_hello
        imagePullPolicy: Never
        ports:
        - containerPort: 4001
          protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
  name: hello
spec:
  selector:
    app: hello
  ports:
  - port: 4001
    nodePort: 30036
    protocol: TCP
  type: NodePort
</code></pre>

<p>And a simple HTTP-server written in Golang</p>

<pre><code>package main
import (
    http "net/http"

    "github.com/gin-gonic/gin"
)

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

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

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

<p>When I make several requests to <em>IP:30036/ping</em> and then open pod's logs, I can see that only 1 of 3 pods handles all requests. How to make other pods response on requests? </p>

ligowsky
<p>You are exposing a service using a NodePort, so there is no reverse proxy in place, but you directly connect to your Pod(s). This is a good choice to start with. (Later you might want to use an Ingress)</p>

<p>What you are seeing is that only one Pod handles your requests. You expect that each request is load balanced to a different pod. And your assumption is correct, but the load balancing does not happen on HTTP request layer, but on the TCP layer.</p>

<p>So when you have a persistent TCP connection and re-use it, you will not experience the load balancing that you expect. Since establishing a TCP connection is rather expensive latency wise usually an optimization is in place to avoid repeatedly opening new TCP connections: HTTP keep-alive.</p>

<p>Keep alive is by default enabled in most frameworks and clients, this is true for Go as well.
Try <code>s.SetKeepAlivesEnabled(false)</code> and see if that fixes your issue. (Recommended only for testing!)</p>

<p>You can also use multiple different clients, f.e. from the command line with curl or disable keep-alive in Postman.</p>
