I have two pods running on Kubernetes. To simplify lets called them A and B. The A is an application which makes HTTP requests. The B is a proxy running in the transparent mode. The questions is how should I alter iptables rules so the traffic coming out from the A goes through the B pod??
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
A (application) NodePort 10.109.208.35 <none> 8090:31000/TCP 3d6h
B (transparent proxy) NodePort 10.98.102.253 <none> 8080:32226/TCP 3h33m
I have tried the following but it doesn't work. Can someone help me to sort it out?
sudo iptables -t nat -D PREROUTING -p tcp --dport 31000 -j REDIRECT --to 32226