http request always blocked in container of k8s cluster pod

12/24/2019

Stages:

  1. connect a container's shell
  2. curl www.xxx.com (//this will always waiting ) ...

Then I use tcpdump in host machine and filter by ip tcpdump -i eth0 host ip

3   11:05:05 2019/12/2  133.5701630 10.171.162.231  111.111.222.333 TCP TCP: [Bad CheckSum]Flags=......S., SrcPort=48836, DstPort=HTTP(80), PayloadLen=0, Seq=126843476, Ack=0, Win=29200 ( Negotiating scale factor 0x7 ) = 29200
4   11:05:05 2019/12/2  133.5704230 111.111.222.333 10.171.162.231  TCP TCP:Flags=...A..S., SrcPort=HTTP(80), DstPort=48836, PayloadLen=0, Seq=3228156738, Ack=126843477, Win=2896 ( Negotiated scale factor 0x9 ) = 1482752
5   11:05:05 2019/12/2  133.5704630 10.171.162.231  111.111.222.333 TCP TCP: [Bad CheckSum]Flags=...A...., SrcPort=48836, DstPort=HTTP(80), PayloadLen=0, Seq=126843477, Ack=3228156739, Win=229 (scale factor 0x7) = 29312
6   11:05:05 2019/12/2  133.5705430 10.171.162.231  111.111.222.333 HTTP    HTTP:Request, GET /api/test, Query:debug
7   11:05:05 2019/12/2  133.5707110 111.111.222.333 10.171.162.231  TCP TCP:Flags=...A...., SrcPort=HTTP(80), DstPort=48836, PayloadLen=0, Seq=3228156739, Ack=126843596, Win=6 (scale factor 0x9) = 3072

The tcp flag is

src -> dst syn
dst -> src syn/ack
src -> dst ack
src -> dst ack/push
dst -> src ack

The curl command will waiting a long time and then throw a timeout error. in normal request there has a dst -> src ack/push packet, but I never received.

I don't know why and how to resolve it.

--- my deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-app-dep
  labels:
    app: test-app
    version: stable
spec:
  replicas: 2
  selector:
    matchLabels:
      app: test-app
      version: stable
  template:
    metadata:
      labels:
        app: test-app
        version: stable
    spec:
      containers:
      - image: test-app
        name: test-app

        livenessProbe:
          httpGet:
            path: /health/status
            port: 80
          initialDelaySeconds: 3
          periodSeconds: 10
        ports:
        - containerPort: 80
-- quanwei li
containers
kubernetes

0 Answers