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

nerdctl port forwarding issue after Reset Kubernetes #670

Open
gunamata opened this issue Sep 24, 2021 · 4 comments
Open

nerdctl port forwarding issue after Reset Kubernetes #670

gunamata opened this issue Sep 24, 2021 · 4 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@gunamata
Copy link
Contributor

Steps to reproduce:

I use the sample at https://github.com/rancher-sandbox/rancher-desktop/tree/e2e-nginx-sample/e2e/assets/python-flask-app-sample

  • I start by switching to kubernetes v1.20.0

  • Reset Kubernetes to start fresh

  • nerdctl --namespace k8s.io build -t simple-flask-app:v1.0 .

  • Check whether the image appears in the image list in the RD UI

  • nerdctl --namespace k8s.io run -p 5000:5000 -it simple-flask-app:v1.0

  • Try localhost:5000 in browser

  • Upgrade kubernetes to v1.21.0

  • nerdctl --namespace k8s.io run -p 5000:5000 -it simple-flask-app:v1.0

  • Try localhost:5000 in browser

@gunamata gunamata added the kind/bug Something isn't working label Sep 24, 2021
@mattfarina mattfarina added this to the v0.5.0 milestone Sep 24, 2021
@mook-as
Copy link
Contributor

mook-as commented Sep 24, 2021

From debugging, it looks like the issue is, roughly:

  • Doing a port forwarding adds an iptables entry (well, multiple, but whatever) (let's call this to container A)
  • The CNI plugin doesn't seem to remove stale entries
  • So when the container goes away (because of a cluster restart), the entries are left over
  • New entries are added when we run a new container (call this container B)
  • The RD agent sees this and adds a forwarder
  • When traffic comes in, the agent forwards to 127.0.0.1 (on the VM), and goes to iptables
  • The first entry (for A) get hit, and the packet is directed to a container that no longer exists.

@gaktive gaktive modified the milestones: v0.5.0, v0.6.0 Sep 27, 2021
@mook-as
Copy link
Contributor

mook-as commented Sep 27, 2021

Matt was correct — the first container was never removed (just no longer running) after the restart:

> nerdctl -n k8s.io ps -a | grep flask
b18669a3b087    docker.io/library/simple-flask-app:v1.0                                                          "/bin/sh -c python f…"    46 minutes ago    Created    0.0.0.0:5000->5000/tcp

I haven't yet figured out how to restart that container, though.

@mattfarina mattfarina modified the milestones: v0.6.0, v0.7.0 Sep 28, 2021
@mook-as mook-as removed their assignment Nov 24, 2021
@gaktive gaktive modified the milestones: v0.7.0, v1.0.0 Dec 8, 2021
@gaktive gaktive modified the milestones: v1.0.0-beta, v1.0.0 Jan 7, 2022
@gaktive gaktive modified the milestones: v1.0.0, v1.1.0 Jan 15, 2022
@gaktive gaktive modified the milestones: Later, Next Feb 22, 2022
@gaktive gaktive modified the milestones: Next, Later Mar 8, 2022
@gunamata gunamata modified the milestones: Next, Later Apr 12, 2022
@gaktive gaktive modified the milestones: Next, Later May 17, 2022
@gaktive
Copy link
Contributor

gaktive commented May 17, 2022

Once we have settings in place, we can look at this again.

@gunamata
Copy link
Contributor Author

A better way to repro this issue as described here, would be to:

  • Run nerdctl run -d -p 85:80 --restart=always nginx

  • Reset Kubernetes with Images 1

  • Run nerdctl run -d -p 85:80 --restart=always nginx

@gunamata gunamata changed the title nerdctl port forwarding issue after k8s version upgrade nerdctl port forwarding issue after Reset Kubernetes Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants