0

I install the k8s master with kubernetes binaries and the cluster works well.

But I face one strange problem.

Firstly, I run command python -m SimpleHTTPServer 9999 in pod2.

And then I make a request in pod1 curl http://<pod2 ip>:9999

The result in pod2 shows like

Serving HTTP on 0.0.0.0 port 9999 ...
10.244.0.1 - - [01/Apr/2021 14:40:34] "GET / HTTP/1.1" 200 -

However, the actual ip of pod1 is 10.244.0.47.

And according to what I found, 10.244.0.1 is the ip address of cni0.

I don't know what caused this probelm.

Could Any one give me a hand?

Hundred
  • 21
  • 4
  • Could you please tell us how exactly did you setup your cluster? Which CNI you use? Also, share the current configs that don't work as you expect + `kubectl get pods -o wide`. Edit your question in order to provide that necessary info. – Wytrzymały Wiktor Apr 01 '21 at 12:42

1 Answers1

0

Finally I found what caused this result.

The container I'm using is docker, which will default create iptable rules. And as a result, the traffic from docker will be changed and then snat will be done on the ip.

Adding "iptables": false to /etc/docker/daemon.json will solve this problem.

Hundred
  • 21
  • 4