C4W2-Lab_2 Windows curl issue


I am trying to run through the ungraded lab 2 for week 2 of the fourth course, but am having some real issues with accessing the deployment.

I installed minikube, virtualbox, kubectl and curl, and through some trial and error managed to start minikube. It was initially unhappy with hyperv being enabled, but turning hyperv off presented a new error telling me that vt-x was turned off (I re-checked multiple times, and it was turned on). I finally just added the --no-vtx-check flag to the minikube start command, and left hyperv enabled.

Now that I have been able to start minikube with virtualbox I am running into a new problem, the curl command. In the powershell window that I used to start minikube, I am copying and pasting the curl command from the readme file, giving me the following error:

Attempting to run the curl command in a new cmd or wsl window causes it to timeout or give me the connection refused error. I have attempted this with both the “$(minikube ip):30001” portion and manually retrieving the minikube ip and writing it into the command.

Any idea as to what I am messing up with here?

Hello, @Krothagon
The main your “mess up” you choose Win over Linux:) I’ve made the same mistake.
Firstly, curl in Win isn’t a tool, it’s an alias for Invoke-WebRequest tool. You can look here Keep windows users engaged :)
But I can’t recommend this way because all Course labs are optimized for Linux/Mac developers. On Win “mess up” will expect you on every corner:) My advice - use wsl2 with a fully functioned Ubuntu (not Docker) image.
Secondly, I couldn’t run minikube on VirtualBox runtime with the same vt-x error and gave up to do that. I switched to docker runtime and had other issues with network connectivity Ungraded Lab: Intro to Kubernetes - needs tunneling?

In result, if you are ready to fight through labs against your environment - windows is your choice. Or follow an easy way on wsl2 and focus on labs content and code.

1 Like

Hi Ludwig! Welcome to Discourse!

Thank you for bringing this to our attention. The lab was tested on Windows 10 Home and didn’t encounter any issues with the installation. However, since you and Alexander have brought up issues with Virtualbox as the VM driver, we’ll modify the instructions to have more commands for Windows or to use WSL2 instead.

In your case, since you’ve already done some workarounds, you can try modifying the command to this:

curl.exe -d '{\"instances\": [1.0, 2.0, 5.0]}' -X POST "$(minikube ip):30001/v1/models/half_plus_two:predict"

The changes compared to the previous command are:

  • use curl.exe to avoid confusion with the Windows built-in curl that is an alias for Invoke-WebRequest (as mentioned by Alexander above). This also implies that you’ve added the curl path to your PATH as mentioned in the curl installation instructions.

  • the additional \ in the instances string is needed because Powershell parses the JSON string differently.

Now to run the script (request.sh) in a later section, there are also some revisions needed:

  1. Please run this command in Powershell to see if scripting is enabled:

Please remember the output value so you can set it back after the exercise. It is most likely Restricted.

  1. Enable scripting with:
Set-ExecutionPolicy RemoteSigned
  1. Then, please create a file called request.ps1 and paste this into it:
{curl.exe -d '{\"instances\": [1.0, 2.0, 5.0]}' -X POST "$(minikube ip):30001/v1/models/half_plus_two:predict"
} WHILE(1)

This mirrors the bash script in request.sh but is modified for Powershell.

  1. With that, you can run the script in Powershell with ./request.ps1

  2. When you’re done with the exercise, you can revert to the original ExecutionPolicy in step 1 in case you want to disable scripting.

On the other hand, if you also have Git for Windows installed in your computer, then you can also use its bundled Git Bash terminal instead of Powershell to run the lab. In my testing just now, you should be able to run all commands (including the request.sh) script as is without any modification in the repo aside from appending .exe to curl and kubectl (i.e. curl.exe and kubectl.exe). Just make sure that kubectl and curl are both in the Windows PATH.

We will modify the instructions to take note of these for Windows users. Thanks again and hope these help!

Hi again Ludwig! I’ve updated the repo with some tips for Windows users. Also incorporated some of Alexander’s feedback. I also made a mistake with one of the commands I showed in the earlier reply. Using the curl.exe program you download, the command should be:

curl.exe -d '{\"instances\": [1.0, 2.0, 5.0]}' -X POST "$(minikube ip):30001/v1/models/half_plus_two:predict"

Notice the quotes in the endpoint string.

Hope these help and hope you’re able to complete the lab!

Interestingly, WSL2 runs on Hyper-V (https://docs.microsoft.com/en-us/windows/wsl/wsl2-faq), but Hyper-V uses VT-X exclusively and doesn’t allow any 3rd party software to get VT-X advantage (https://forums.virtualbox.org/viewtopic.php?t=87752).
It looks like mutually exclusive access compels to switch to PowerShell in C4W2-Lab_2 Windows users:)

Hello Chris and Alexander,

Apologies for the lack for the lack of replies from my end the last few days, have had to focus on some other things at work and have completely forgotten to check in on Discourse.

Thank you very much for your help and suggestions! I am hoping to have some time to try these assignments again today or tomorrow and will let you know if things work out or not as soon as possible!

Thanks again! :smiley:

Hello again @skipper-com and @chris.favila,

I have finally had time to give this another shot, and can happily say that everything worked out with the new troubleshooting instructions added to the README.md! It seems that the key step for me at least was the minikube tf-serving-service command to allow me to connect to the model. After adding that step I was finally able to connect to the model and get predictions.

Thank you so much for your help! :smiley:

1 Like

Awesome! Glad it worked!

1 Like

Hi everyone,

A little follow up question on this ticket. I am using windows and encountered the exact same issue.

However, after following the windows tips of using curl.exe, I still have the following error message
curl: (7) Failed to connect to port 30001: Timed out

It seems that it is due to connection to the local port but I have not idea on how to fix this.

Please help.

Thank you,

Any idea on how to resolve it ?