Minikube doesn't start on Windows Server 2019 - windows

I've installed Minikube to use along with Docker on Windows Server 2019. However, when I try to start with minikube start, it shows the follow errors:
Failed to start hyperv VM. Running "minikube delete" may fix it: Error loading existing host.
Hyper-V\Start-VM minikube
CategoryInfo : NotSpecified: (:) [Start-VM], VirtualizationException
FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.StartVM
minikube delete does not fix it.
When I start with minikube start --driver=hyper-v, it shows:
Exiting due to DRV_UNSUPPORTED_OS: The driver 'hyper-v' is not supported on windows/amd64
I already made an external switch on HyperV, as suggested in some videos, but it also did not work.
How can I fix it?

Have you enabled hyper-v?
On sv2019 you can practice k8s by enabling it on docker desktop, it's much easier and simpler.

Related

Minikube start fails to create VM

I am trying to start Minikube but it fails at the creation of the VM.
Last Thursday it was working fine, but Friday, I tried to start it while using a VPN (cisco), and it didn't work well (which seems to be a well-known problem with Cisco), so I tried to mess with some network settings, change the Minikube version... without success
But now, even without the VPN it doesn't work. I tried to disable and reenable Hyper-V, uninstall and reinstall Minikube but no changes.
In the logs, I see that the creation of the VM blocks on this line
I1017 09:50:30.831122 12020 main.go:134] libmachine: [stderr =====>] :
I1017 09:50:30.832236 12020 main.go:134] libmachine: [executing ==>] : C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive [Console]::OutputEncoding = [Text.Encoding]::UTF8; ConvertTo-Json #(Hyper-V\Get-VMSwitch|Select Id, Name, SwitchType|Where-Object {($_.SwitchType -eq 'External') -or ($_.Id -eq 'c08cb7b8-9b3c-408e-8e30-5e16a3aeb444')}|Sort-Object -Property SwitchType)
Any ideas where this might come from ? Thanks
I think I was able to reproduce your issue.
Try with minikube delete --all and minikube delete --purge and start again your minikube increasing the cpus and memory.
minikube config --driver=hyperv and
minikube start --driver=hyperv --cpus 2 --memory=4078

Unable to install Cassandra on Windows

Hey Guys I'm unable to install Cassandra on my PC. I'm getting an error like this
"cassandra : The term 'cassandra' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
cassandra
+ CategoryInfo : ObjectNotFound: (cassandra:String) [], Command
NotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command cassandra was not found, but does exist in the current location. Windows PowerShell does not load commands from the current location by default. If you trust this command, instead type: ".\cassandra". See "get-help about_Command_Precedence" for more details."
I'm attaching all the screenshots, pleaseenter image description here let me know where I'm gone wrong!
Windows support was completely dropped in Cassandra 4.0 (CASSANDRA-16171). There are several known issues with running Cassandra on Windows so support was limited even in earlier versions of Cassandra.
The recommended workarounds are:
Deploy Cassandra in Docker
Deploy Cassandra in a VM using
software like VirtualBox
Deploy Cassandra in a Kubernetes cluster
with K8ssandra.io
Otherwise if you just want to learn how to build apps on Cassandra, Astra DB has a free tier and you can launch a cluster in 5 clicks. Cheers!
As another possible method of achieving this, I recommend running Cassandra on Minikube. I did a video on this recently, and have a Git repository full of scripts and steps to help folks get this running.
Here are the high-level steps (from the repo):
Download & install Minikube: https://minikube.sigs.k8s.io/docs/start/
Clone my repo:
git clone git#github.com:aar0np/cassandra_minikube.git
Start Minikube, limiting it to 3GB and 2 CPUs:
minikube start --memory 3072 --cpus=2
Create a Kubernetes "service"
minikube kubectl -- apply -f cassandra-service.yaml
Create a Kubernetes "StatefulSet"
minikube kubectl -- apply -f cassandra-minikube_1node.yaml
Set up and run a port-forward
minikube kubectl -- port-forward service/cassandra 9042:9042

Docker : Hyper-V was unable to find a virtual switch with name "DockerNAT"

I updated my docker for desktop app (Version 2.0.0.3) on Windows 10 pro.But since then my docker is not starting and throwing following error.
Hyper-V\Get-VMNetworkAdapter : Hyper-V was unable to find a virtual switch with name "DockerNAT".
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:121 char:25
+ ... etAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $S ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (DockerNAT:String) [Get-VMNetworkAdapter], VirtualizationException
+ FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVMNetworkAdapter
I followed the steps mentioned in the link (Docker on windows 10 can't startup after deleting MobyLinuxVM in Hyper-V manually ) , but it did not fix the issue.
I have also tried disabling --> restarting --> and then enabling Hyper V and containers option using "Turn windows feature on or off" present at "Control Panel\Programs\Programs and Features"
My network connection has following information
But still I am not being able to start my windows Docker app, which keeps throwing
Hyper-V was unable to find a virtual switch with name "DockerNAT".
at New-Switch, <No file>: line 121
at <ScriptBlock>, <No file>: line 411
I also faced this issue once.
I tried several workarounds but nothing worked. The issue was that the MobyLinuxVM could not create the Docker NAT switch, as a result Docker service could not be started.
The working solution was to reset my network settings. I cannot remember if I had to remove all network related entries in Computer Management in order to be re-initialized from scratch.
Important: You will lose all user defined network-related settings. Try it if everything else fails.
Edit: Another thing you can try is to restart the Hyper-V management service by executing the following commands in an admin shell:
net stop vmms
net start vmms
Found in related github issue
open the hyper-v manger and check in the "Virtual switch manager" if you can see the DockerNAT there or not , Docker for windows created this switch when it starts before creating the mobylinux vm.
if your powershell script is not creating this switch ten try to create it directly there .
I was facing the same issue after updating the docker version and got resolved by doing the following steps. Please note that i have following OS running in my machine.
Edition Windows 10 Enterprise
Version 1903
Os Build 18362.295
1:- Open "Window Security"
2:- Open "App & Browser control"
3:- Click "Exploit protection settings" at the bottom
4:- Switch to "Program settings" tab
5:- Locate "C:\WINDOWS\System32\vmcompute.exe" in the list and expand it
6:- Click "Edit"
7:- Scroll down to "Code flow guard (CFG)" and uncheck "Override system settings"
8:- Start vmcompute from powershell "net start vmcompute"
None of these worked for me. I have tried countless of possible solutions reported by others. In the end, this rather old post helped:
https://forums.docker.com/t/latest-failed-docker-update-makes-hyper-v-unable-to-create-virtual-ethernet-switch-0x80041002/44109
So to fix the issue:
uninstall crippled Docker for Windows
remove both Hyper-V and Containers features then reboot
add Hyper-V and Containers features back then reboot
reinstall Docker for Windows then start it
Hope this helps!
Running the MOFCOMP command and a reboot fixed this problem for me.
Running this command: (Command Prompt as administrator)
MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof
Then restart
(https://community.spiceworks.com/how_to/122307-fix-error-managing-hyper-v-server-2012-r2-from-windows-10)
To solve the issue follow the steps which write in the microsoft's document below
https://support.microsoft.com/en-us/help/3101106/you-cannot-create-a-hyper-v-virtual-switch-on-64-bit-versions-of-windo
Then restart your PC.
After restarting
Open Hyper-V Manager
Goto Virtual Switch Manager
Create new Internal virtual switch with name DockerNAT
Start your docker
I had the same problem on windows 10 and after installing "MicrosoftEasyFix20159.mini.diagcab" my problem was solved. I think instead of creating manually a new "Internal virtual switch with name DockerNAT", installing this Microsoft Easy Fix works.
My Docker Desktop gave me a similar error
It was exactly this:
The virtual switch 'DockerNAT' cannot be deleted because it is being
used by running virtual machines or assigned to child pools.
My Solution was
Open Hyper-V manager
Shutdown the default machine or how your docker-machine is called
Then try to open Docker Desktop
I hope this was helpful for someone

Kubernetes connection error in Mac

OS : OSX (mac)
Docker : 18.06.0-ce (edge)
Kubernetes : 1.10.3
I use Kubernetes for the first time.
I tried Google but could not find the manual for Kubernetes, which operates on the Mac.
Running kubectl version outputs The connection to the
server localhost:8080 was refused - did you specify the right host or port?
I came across this issue when changing from minikube to the Docker Desktop supplied Kubernetes. For me, the issue was caused by a stale .kube configuration. Posting my workaround here as this was the first result I found on google when looking to troubleshoot the issue.
1. Uninstall Minikube
I had originally installed with homebrew: brew uninstall minikube. If installed using other methods, go back to your install source for uninstall info.
After minikube was uninstalled, I restarted my machine which may or may not have been necessary but it is what I did.
2. Disable Kubernetes in docker Desktop
Open Docker Desktop preferences, click Kubernetes menu
De-select 'Enable Kubernetes' checkbox. Click Apply & Restart
3. Remove old kube and minikube config
Open terminal to your home directory.
Check for settings directories: ls -al and look for .kube and .minikube.
Remove .kube settings: rm -rf ./.kube.
Remove .minikube settings: rm -rf ./.minikube.
Confirm: ls -al and make sure the .kube and .minikube directories have been deleted.
If everything looks good, close terminal.
4. Re-enable Kubernetes in Docker Desktop
Open Docker Desktop preferences, click Kubernetes menu
Select 'Enable Kubernetes' checkbox. Click Apply & Restart
Open new terminal window and run kubectl version. You should see info for Client Version and Server Version if everything worked.
When you run kubectl, the .kube/config file is read in your home directory, thus telling which cluster you want to connect to using --context=<cluster-name>
What your error output is telling you is that it is unable to find a listening kubernetes API endpoint upon which to run those commands. It is looking for a cluster at localhost:8080
This endpoint will vary depending on how and where you installed Kubernetes. How are you running Kubernetes?
Are you using the bundled Docker/Kubernetes for Mac as mentioned here? - Docker for Mac Kubernetes or are you using a tool like MiniKube? - MiniKube
You might notice this error The connection to the server localhost:8080 was refused - did you specify the right host or port? because of your local minikube server might be down.
You have to start the existing minikube instance using - minikube start (I'm assuming your local minikube configured with docker driver earlier like: minikube start --driver=docker)
If not working above step then you have to delete the existing minikube then start it again:
minikube delete
minikube start --driver=docker
I had faced the same issue and my user id did not had the admin privileges, once the chown is done, Kubernetes started working.Hope this helps

Starting minikube on Windows 7 fails to start with - Error getting state for host: machine does not exist

Have been trying to setup Kubernetes for local development on my Windows 7 machine with a VirtualBox VM Driver. Installing and running minikube fails each time with the below error:
D:\minikube>minikube start --vm-driver=virtualbox
Starting local Kubernetes v1.9.0 cluster...
Starting VM...
E0219 09:47:24.441727 4220 start.go:159] Error starting host: Error getting state for host: machine does not exist.
Retrying.
E0219 09:47:24.448727 4220 start.go:165] Error starting host: Error getting state for host: machine does not exist
E0219 09:47:54.448727 4220 util.go:151] Error uploading error message: :
Post https://clouderrorreporting.googleapis.com/v1beta1/projects/k8s-minikube/events:report?key=AIzaSyACUwzG0dEPcl-eOgpDKnyKoUFgHdfoFuA: dial tcp 172.217.25.138:443: i/o timeout
I suspected this may be happening due to minikube cache downloading at a network drive folder (N:) due to enterprise configurations in my laptop, however, copying the .minikube folder from N:\.minikube to C:\Users\abc123\.minikube has not abated the problem.
Do let me know if someone has managed to solve it.
I ran into the same error on osx after re-installing minikube. Simply deleting the minikube VM and restarting fixed everything:
$ minikube delete
$ minikube start
Go to C:\Users\\
Delete the .minikube folder
Start minikube (minikube.exe start --kubernetes-version="v1.10.0" --vm-driver="virtualbox")
Try using powershell/cygwin instead of cmd.
Also delete .minikube folder
do minikube delete
then minikube start
In certain scenarios, it may be an issue with your VM driver. If you don't specify one, it may default to VirtualBox. But if you have HyperV instead (due to installing docker on windows, for example) then it won't start. You may have to start it like so:
minikube start --vm-driver hyperv
Or whatever is appropriate.

Resources