Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change traffic-agent's target port to podIP instead of localhost. #3675

Merged
merged 6 commits into from
Aug 26, 2024

Conversation

thallgren
Copy link
Member

Using the IP of the pod means that an application now has a choice to
either bind to that IP or to localhost. Internally, it also meant that
we could implement a safer routing from the traffic-agent to the app-
container when numeric ports were used.

In detail, there's a huge difference between requests that the traffic-
agent performs on behalf of a client that wants to connect to the app,
and the forwarding it does to the app during times when no intercepts
are active. The former must be routed back to the agent, so that
potential intercepts are served correctly, whereas the latter must not
be routed back, because that would result in an endless loop.

thallgren and others added 6 commits August 25, 2024 15:27
Routing traffic to localhost will effectively bypass any injected
sidecar that modifies the iptables for incoming traffic. This commit
mitigates that problem by routing to the pod-IP instead.

The fix currently applies when the intercepted service's `targetPort`
is symbolic. More work is needed in our init-container to also enable
this for numeric ports.

Signed-off-by: Thomas Hallgren <[email protected]>
So that the echo-server can listen to the IP of the host rather than
just localhost.

Signed-off-by: Thomas Hallgren <[email protected]>
Using the IP of the pod means that an application now has a choice to
either bind to that IP or to localhost. Internally, it also meant that
we could implement a safer routing from the traffic-agent to the app-
container when numeric ports were used.

In detail, there's a huge difference between requests that the traffic-
agent performs on behalf of a client that wants to connect to the app,
and the forwarding it does to the app during times when no intercepts
are active. The former must be routed back to the agent, so that
potential intercepts are served correctly, whereas the latter must not
be routed back, because that would result in an endless loop.

Closes #3473

Signed-off-by: Thomas Hallgren <[email protected]>
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Aug 26, 2024
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Aug 26, 2024
@thallgren thallgren merged commit 6343586 into release/v2 Aug 26, 2024
11 checks passed
@thallgren thallgren deleted the thallgren/route-to-podip branch August 26, 2024 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant