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

AWS_VPC_K8S_CNI_RANDOMIZESNAT matching PODs with hostNetwork: True #1969

Closed
adamdunstan opened this issue Apr 13, 2022 · 8 comments
Closed

Comments

@adamdunstan
Copy link

What happened:

We have an application that uses hostnetwork: true and sends traffic from a specific public port. The public port and hostNetwork: true is used because traffic is returned to the host/port. By default the CNI is SNATing the PORTS.

What you expected to happen:
Is this the expected default behaviour, I would think that the expected behavior would be that for hostNetwork: true, the set port is not modified.

The expected default behaviour when using hostNetwork: true is that the port remains unchanged.

Environment:

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"22+", GitVersion:"v1.22.6-eks-7d68063", GitCommit:"f24e667e49fb137336f7b064dba897beed639bad", GitTreeState:"clean", BuildDate:"2022-02-23T19:29:12Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}

amazon-k8s-cni:v1.10.2-eksbuild.1

[ec2-user@ip-192-168-99-208 ~]$ cat /etc/os-release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

Linux ip-192-168-99-208.ec2.internal 5.4.181-99.354.amzn2.x86_64 #1 SMP Wed Mar 2 18:50:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

@achevuru achevuru self-assigned this Apr 19, 2022
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days

@github-actions github-actions bot added the stale Issue or PR is stale label Jul 10, 2022
@jayanthvn
Copy link
Contributor

/not stale

@github-actions github-actions bot removed the stale Issue or PR is stale label Jul 11, 2022
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days

@github-actions github-actions bot added the stale Issue or PR is stale label Sep 24, 2022
@github-actions
Copy link

github-actions bot commented Oct 8, 2022

Issue closed due to inactivity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 8, 2022
@henry-colektia
Copy link

Hi, can we reopen this? I have the exact same problem. Keeping the IP and port is important in some applications, SIP applications in my case. I thought setting hostNetwork to true would be sufficient but ran into this behavior and spent hours finding why. It should be at least documented. The docs say that pods running with hostNetwork: true IP won't be affected by SNAT, but doesnt mention that the source port would be affected.

@jdn5126 jdn5126 removed the stale Issue or PR is stale label Jan 2, 2024
@jdn5126 jdn5126 reopened this Jan 2, 2024
@jdn5126
Copy link
Contributor

jdn5126 commented Jan 2, 2024

@henry-colektia which document are you referring to? We can work on getting the documentation updated.

As for the behavior, the SNAT is implemented via iptables, so there is no distinguishing when the source pod is in the host networking namespace vs a pod networking namespace

@jdn5126
Copy link
Contributor

jdn5126 commented Jan 30, 2024

Closing issue as this is expected behavior

@jdn5126 jdn5126 closed this as completed Jan 30, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants