-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Port forwarding not work when pods recreated #2408
Comments
I'm seeing this exact issue after upgrading from 0.32.0 to 0.33.0. Skaffold command:
|
Hey @cmoad -- so I merged #2215 recently which changed the functionality of port-forward for |
for me it looks like the port-forwarding is initiated while the pods that are linked to the service are still "terminating". Once the new pod is initiated, the port-forward command which is already/still running will not be updated to link to the new pod. Maybe this could be solved by re-initiating the port-forward when the kubectl port-forward gives "No such container" or "Timeout occured" errors. |
Hey @japsen so we currently poll |
@priyawadhwa In my case I have some simple k8s deployments consisting of 4 deployments (redis, elastic, postgres, our product) All 1 replica; having a service that exposes the ports (ClusterIP).
At that moment, the pods are still on "ContainerCreating". On the initial deployment on an empty cluster it takes about 110 seconds for all pods to be 1/1 Running. If I trigger a rebuild by altering a file outside of the "sync" folders (file sync works OK!) then after pushing to the repo, the product pod will be on 1/1 Terminating for about 30 seconds. After that 0/1 Terminating and after about 10 seconds the new pod will be on 1/1 Running. In the meantime the port-forward was already established towards the service/productname during the 1/1 Terminating phase. It looks like it doesn't get updated or reset once the pod reaches it's 1/1 Running phase. If I manually trigger the following bash script at that moment, then the port forwarding works OK.
I'm running skaffold v0.33.0 on mac. |
@priyawadhwa On first run I can see the services getting successfully forwarded:
However, if the underlying pods change during a deployment update the service port forward becomes unresponsive.
It looks like the service is still forwarding to the pods correctly inside the minikube VM:
One more test to confirm the tunnel is dropped:
|
@japsen -- thanks for your detailed explanation, I'll take a look at it more closely and let you know what next steps would be. @cmoad -- this is currently expected behavior. skaffold only establishes a connection after deploy and doesn't continuously check if the connection is valid. So, if a user manually changes the pod underneath the service that is being port-forwarded, skaffold won't pick up on that change, and the connection won't work anymore. |
hi @priyawadhwa thanks for being on this! I just tested the bleeding edge bin. Two breaking problems that occur:
my skaffold version is: 9981c37 |
@japsen thanks for testing this out! Since both of these bugs seem unrelated to port forwarding, would you mind opening new issues for them? And if the port forwarding bug is fixed, we can go ahead and close this issue. |
Same issue here. Had to roll back to v0.31 for it to work. |
Just tried it with the latest version |
@demisx could you please provide logs for the bug you're seeing? |
@priyawadhwa Hmm... There is really nothing different in the logs I am seeing. It's just, as others mentioned, the app no longer works on its port after skaffold updates the docker image and launches a new pod. The port is still open and listening, but any request to it simply times out. Again, this happens after the first update that requires skaffold to build a new image and launch it in a new pod. Works fine in v0.31. |
@priyawadhwa It seems like port forwarding the deployment has the same effect in v0.33.0. Is there any way to produce a reliable port forward as seen in v0.32.0? Thanks. |
@priyawadhwa I am using |
Could there be some workaround for this issue, until the fix released? |
My workaround so far was to roll back to v0.31. The last version that just works for me. |
@priyawadhwa Tried the latest bleeding edge binary, it seems to work. Thank you very much! |
@priyawadhwa I've been using the latest bleeding edge binary
|
@priyawadhwa I too have this issue.
Observed Behaviour
Steps to Reproduce
apiVersion: skaffold/v1beta13
kind: Config
build:
artifacts:
- image: gcr.io/k8s-skaffold/node-example
context: backend
deploy:
kubectl:
manifests:
- k8s/*.yaml
You can find my full console output here, let me know if I can provide anything else that might help:
|
I've been testing with the latest bleeding version |
@demisx - I'm sorry to see this and thank you for persisting in testing with us, we are focused on getting this stabilized asap. The Can you share a bit more info? Are you on minikube? On linux/mac/windows? |
@demisx - master contains one more port-forward fix, it should be all good now. After a couple of refreshes (while the new pod is coming up, and potentially We noticed today a bug with the latest minikube - if you are on minikube 1.2.0 - make sure to wait until #2577 is merged. |
@balopat I am happy to help where I can as Skaffold is one cool project that makes our development more efficient daily. I've been using the latest Here is my environment:
Please let me know if you need any other info. |
@demisx thanks for the info, and glad to hear you're seeing the issue fixed with the latest commits! this has obviously been a pain for us recently so any progress is good progress :) since this particular issue seems to be resolved I'm gonna close this issue, but if you are still seeing the other problems you reported here, please open them up in separate issues so we can track them 👍 |
@nkubala Got it. So, is it OK to create new GitHub issues for problems I am seeing in the latest |
yes thats fine! the sooner we catch the issues the better :) just be sure and include the commit if you're seeing them at |
I'm making a simple golang app and trying to use skaffold for local development with
skaffold dev --port-forward
.However, it only works for the first time, then fails to open ports again when files changed and pods recreated. I even tried v0.33.0 and the latest version
2f2a6f4
, neither works.I checked issue #1594 #1815 and tried v0.29.0, and it works as I expected.
I notice that when I use v0.33.0, every time I changed files, skaffold will start a new pod then exit (delete?) the old one, but when I use v0.29.0, only the new one starts, and there is no exit log. So I guess is the old one blocks port-forward somehow since v0.29.0
Expected behavior
Recreate port forwarding correctly just like v0.29.0 did.
Actual behavior
Only successful for the first time.
Information
Steps to reproduce the behavior
skaffold dev --port-forward
, can see port-forward works for the first time.skaffold dev --port-forward
, it works again.The text was updated successfully, but these errors were encountered: