paciorek / future-kubernetes

Instructions for setting up and using a Kubernetes cluster for running R in parallel using the future package.
39 stars 10 forks source link

Known error with kubectl port-forward #5

Closed 1beb closed 3 years ago

1beb commented 3 years ago

Hello and thank you for this easy to follow guide. I want to leave a quick note for passerby:

I was experiencing a problem when trying to port forward the RStudio session:

E0617 13:06:27.613454  492930 portforward.go:340] error creating error stream for port 8787 -> 8787: Timeout occurred
E0617 13:06:28.010093  492930 portforward.go:362] error creating forwarding stream for port 8787 -> 8787: Timeout occurred
E0617 13:06:45.389702  492930 portforward.go:340] error creating error stream for port 8787 -> 8787: Timeout occurred

This appears to be a known issue: https://github.com/kubernetes/kubernetes/issues/74551

Solution:

You can start the port-forward without specifying the host port, allowing kubectl to decide:

kubectl port-forward --namespace default svc/future-scheduler :8787 

kubectl will set the port for you:

Forwarding from 127.0.0.1:38491 -> 8787
Forwarding from [::1]:38491 -> 8787
Handling connection for 38491
Handling connection for 38491
Handling connection for 38491
Handling connection for 38491
Handling connection for 38491

Then you navigate to that link in your browser locally. (In this case it was localhost:38491 / 127.0.0.1:38491)

NB: In the issue identified above there was some mention that restarting port-forward after not specifying a port but this time with a port, works as expected. I have not tested this.