<p>I am trying to understand about egress traffic controlling in <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/" rel="nofollow noreferrer">Kubernetes-Operator</a>. If I implement Kubernetes operator in my k3s setup, how the egress traffic flow happens in the operator?</p>
<p>I want to understand that what pathway/gateway and routing happens with egress traffic flow happens in the Kubernetes operator (journey of egress traffic)?</p>

solveit
<p>As a general rule, egress traffic leaves your SDN from the Node hosting your Pod. The Node would NAT it, using its own IP on your underlay network.</p>
<p>Now, if by Egress you mean &quot;anything that leaves my Pod&quot; / regarding communications that stay within the SDN. Bearing in mind that:</p>
<ul>
<li>the SDN has two subnets (pod network, service network), and that your pod network is split into smaller subnets, statically allocated to your Kubernetes nodes:</li>
<li>Services have (usually/when spec.clusterIP != None) their own fixed IP.</li>
<li>for each Service in your cluster, you have an Endpoint object, that lists all Pods with matching labels, that are considered to be &quot;Ready&quot;</li>
</ul>
<p>Connecting a Service, the Node firewall (usually ipvs or iptables, as configured per kube-proxy) would redirect your connection one of the addresses listed in the corresponding Endpoint object. At which point, your Node routing table takes over:</p>
<ul>
<li>if the target address is local (in the pod subnet that was allocated to your Node), then communication is direct.</li>
<li>if the target address belong to a network allocated to another node in your cluster, then traffic would go through your SDN containers (calico, flannel, ovs, ...), reaching its destination.</li>
</ul>
