<p>I am migrating to Azure platform from GCP. I have a k8s cluster that needs to talk to external Cassandra cluster using internal IP(s), in the same Azure region but different VNET. I have the VNET(s) peered. I can reach the Cassandra cluster from the K8s nodes and vice versa but cannot reach them from the pods.</p>

<p>This seems to be some Azure networking issue. I have opened up firewall rules for the pods to reach Cassandra but with no luck. How best should I solve this?</p>

<p>Because Azure can't find your private IP address of your pods. We can use Azure <strong>route table</strong> to connect them.</p>

<p>Here is my test, two resource group, one for k8s and another one for a signal VM.</p>

<p>Here is the information about pods:</p>

<pre><code>root@k8s-master-CA9C4E39-0:~# kubectl get pods --output=wide
NAME                       READY     STATUS    RESTARTS   AGE       IP             NODE
influxdb                   1/1       Running   0          59m       10.244.1.166   k8s-agent-ca9c4e39-0
my-nginx-858393261-jrz15   1/1       Running   0          1h        10.244.1.63    k8s-agent-ca9c4e39-0
my-nginx-858393261-wbpl6   1/1       Running   0          1h        10.244.1.62    k8s-agent-ca9c4e39-0
nginx                      1/1       Running   0          52m       10.244.1.179   k8s-agent-ca9c4e39-0
nginx3                     1/1       Running   0          43m       10.244.1.198   k8s-agent-ca9c4e39-0
</code></pre>

<p>The information about K8s agent and master :</p>

<p><a href="https://i.stack.imgur.com/loZrQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/loZrQ.png" alt="enter image description here"></a></p>

<p>The information about the signal VM:</p>

<p><a href="https://i.stack.imgur.com/JDeuT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JDeuT.png" alt="enter image description here"></a></p>

<p>By default, we can't use <code>172.16.0.4</code> to ping <code>10.244.1.0/24</code>. We should add an Azure route table, then we can ping that pod IP address:</p>

<p><a href="https://i.stack.imgur.com/EVlF1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EVlF1.png" alt="enter image description here"></a></p>

<p>Here is my result:</p>

<pre><code>root@jasonvm2:~# ping 10.244.1.166
PING 10.244.1.166 (10.244.1.166) 56(84) bytes of data.
64 bytes from 10.244.1.166: icmp_seq=1 ttl=63 time=2.61 ms
64 bytes from 10.244.1.166: icmp_seq=2 ttl=63 time=1.42 ms
--- 10.244.1.166 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.424/2.019/2.614/0.595 ms
root@jasonvm2:~# ping 10.244.1.166
PING 10.244.1.166 (10.244.1.166) 56(84) bytes of data.
64 bytes from 10.244.1.166: icmp_seq=1 ttl=63 time=2.56 ms
64 bytes from 10.244.1.166: icmp_seq=2 ttl=63 time=1.10 ms
^C
--- 10.244.1.166 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.102/1.833/2.564/0.731 ms
root@jasonvm2:~# ping 10.244.1.63
PING 10.244.1.63 (10.244.1.63) 56(84) bytes of data.
64 bytes from 10.244.1.63: icmp_seq=1 ttl=63 time=2.89 ms
64 bytes from 10.244.1.63: icmp_seq=2 ttl=63 time=2.27 ms
--- 10.244.1.63 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 2.271/2.581/2.892/0.314 ms
</code></pre>

<p>About Azure route table, please refer to this <a href="https://learn.microsoft.com/en-us/azure/virtual-network/virtual-networks-udr-overview" rel="nofollow noreferrer">link</a>.</p>
