cloudnativedevops / demo

Simple demonstration app for 'Cloud Native Devops'
MIT License
799 stars 517 forks source link

kubectl port-forward gives "error upgrading connection: error dialing backend: dial tcp 10.204.101.149:10250: i/o timeout" #29

Closed dwschulze closed 1 year ago

dwschulze commented 4 years ago

I apply the .yaml files like this:

$ kubectl apply -f src/k8s/cloudnativedevops/ch04/deployment.yaml deployment.apps/demo created

$ kubectl apply -f src/k8s/cloudnativedevops/ch04/service.yaml service/demo created

Then when I try to start port forwarding it gives the error below: $ kubectl port-forward --address 0.0.0.0 service/demo 6817:8888 error: error upgrading connection: error dialing backend: dial tcp 10.204.101.149:10250: i/o timeout

This happens most of the time, but not all of the time. Is there something I have to do before restarting port forwarding?

bitfield commented 4 years ago

Hey @dwschulze, thanks for the report! I'm not totally sure what could be causing this. What kind of Kubernetes are you using? Minikube? Docker Desktop? GKE? Something else?

Could it be related to this issue? https://github.com/kubernetes/kubectl/issues/587

dwschulze commented 4 years ago

I'm running k8s on bare metal. No cloud, so the security group issues in #587 aren't there. I'm using v 1.18. Maybe that makes a difference.

bitfield commented 4 years ago

Okay. Exactly what code are you applying? The path in your command doesn't look like it's from this repo.

piotr-kierklo-looker commented 1 year ago

I know this is an old thread, but I came across this issue now, so decided to share my solution.

I had this problem when my local kubectl version was too old, comparing to the Kubernetes version on the server/cluster

Just do kubectl version and compare the versions

domingusj commented 1 year ago

Thank you for confirming @piotr-kierklo-looker! Going to close this issue for now, but feel free to reopen if needed.