Minikube nodeport service and port forwarding

Hello 

I have a workstation based on code-oss:latest image.

I use minikube and I want to access a service with my browser using:
https://cloud.google.com/workstations/docs/use-port-forwarding

The output of "minikube ip" is 192.168.49.2

I can create a nodeport service listening on port 30188 and if I test it locally with this curl command: curl -kL 192.168.49.2:30188, it works fine.

But when I use port forwarding in my browser: https://30188-*.cloudworkstations.dev/

I have this error :

Unable to forward your request to a backend

Couldn't connect to a server on port 30188. Ensure you have selected the correct port with a HTTP server running on it.

Thank you

Eric

Solved Solved
0 4 3,524
1 ACCEPTED SOLUTION

Hi @erict ,

If you are receiving the error "Unable to forward your request to a backend" or "Couldn't connect to a server on port 30188" when accessing the service from your local browser using port forwarding, there could be a few reasons for this issue. You can try these steps to identify and fix the issue:

1. Make sure you have a NodePort service running in Minikube on port 30188, and you can access it using curl -kL 192.168.49.2:30188.
2. To access the service from your local browser, run this command in your terminal:


kubectl port-forward service/YOUR_SERVICE_NAME 30188:30188

3. After setting up port forwarding, open your browser and type http://localhost:30188 in the address bar.
4. If you encounter an error, check if the service is running (kubectl get svc YOUR_SERVICE_NAME) and that your firewall or network settings are not blocking the connection.
5. If everything looks fine, try restarting Minikube and testing again.

Remember, port forwarding forwards traffic from your machine to the Minikube cluster, allowing you to access the service locally as if it were on your own computer.

 

View solution in original post

4 REPLIES 4

Hi @erict ,

If you are receiving the error "Unable to forward your request to a backend" or "Couldn't connect to a server on port 30188" when accessing the service from your local browser using port forwarding, there could be a few reasons for this issue. You can try these steps to identify and fix the issue:

1. Make sure you have a NodePort service running in Minikube on port 30188, and you can access it using curl -kL 192.168.49.2:30188.
2. To access the service from your local browser, run this command in your terminal:


kubectl port-forward service/YOUR_SERVICE_NAME 30188:30188

3. After setting up port forwarding, open your browser and type http://localhost:30188 in the address bar.
4. If you encounter an error, check if the service is running (kubectl get svc YOUR_SERVICE_NAME) and that your firewall or network settings are not blocking the connection.
5. If everything looks fine, try restarting Minikube and testing again.

Remember, port forwarding forwards traffic from your machine to the Minikube cluster, allowing you to access the service locally as if it were on your own computer.

 

Thanks a lot

I completely forgot about kubectl port-forward 😥

It still not working it is showing timeout 

@Marvin_Lucero  I am still not access it on browser. 

ubuntu@ip-172-31-8-109:~$ kubectl port-forward service/grafana-ext 30148:3000
Forwarding from 127.0.0.1:30148 -> 3000
Forwarding from [::1]:30148 -> 3000 

It stuck here i don't know why