<p>In Azure Kubernetes (AKS) if pod sending the traffic outside the cluster it get Natted to the Node IP address. For example, if pod nettools ( from node aks-agentpool-35359625-1 ) sending the traffic to Azure destinations that is outside of the cluster it get natted to 10.240.0.35. Is there a way to preserve the original source ( 10.240.0.48 ) ?</p>

<p>Cluster running with networking plugin azure and transparent networking mode</p>

<pre><code>/AKS/cluster1 $ kubectl get nodes -o wide 
kubectl get pods -o wide
NAME                       STATUS   ROLES   AGE     VERSION    INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
aks-agentpool-35359625-0   Ready    agent   6h13m   v1.15.10   10.240.0.66   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.15.0-1071-azure   docker://3.0.10+azure
aks-agentpool-35359625-1   Ready    agent   6h13m   v1.15.10   10.240.0.35   &lt;none&gt;        Ubuntu 16.04.6 LTS   4.15.0-1071-azure   docker://3.0.10+azure
aks-agentpool-35359625-2   Ready    agent   6h13m   v1.15.10   10.240.0.4    &lt;none&gt;        Ubuntu 16.04.6 LTS   4.15.0-1071-azure   docker://3.0.10+azure
/AKS/cluster1 $ kubectl get pods -o wide
NAME       READY   STATUS    RESTARTS   AGE   IP            NODE                       NOMINATED NODE   READINESS GATES
nettools   1/1     Running   0          21m   10.240.0.48   aks-agentpool-35359625-1   &lt;none&gt;           &lt;none&gt;

/AKS/cluster1 $ az aks show -g $rg --name $cluster --query "networkProfile"
{
  "dnsServiceIp": "10.0.0.10",
  "dockerBridgeCidr": "172.17.0.1/16",
  "loadBalancerProfile": null,
  "loadBalancerSku": "Basic",
  "networkMode": "transparent",
  "networkPlugin": "azure",
  "networkPolicy": null,
  "outboundType": "UDR",
  "podCidr": null,
  "serviceCidr": "10.0.0.0/16"
}
</code></pre>

<p>You can edit the azure-ip-masq-agent configmap to add the target private IP CIDR that you don't want it to be Masqueraded.</p>
<pre class="lang-sh prettyprint-override"><code>kubectl get pods --namespace kube-system -l &quot;k8s-app=azure-ip-masq-agent&quot; -o wide

kubectl describe configmap azure-ip-masq-agent-config --namespace kube-system

# Add x.x.x.x/x to the nonMasq CIDRs
kubectl edit configmap azure-ip-masq-agent-config --namespace kube-system

</code></pre>
