Minikube start fails to create VM - windows

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

Related

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

Minikube doesn't start on Windows Server 2019

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.

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.

Docker unreachable after computer sleep

I have just installed docker using docker-toolbox 1.8.2 on Windows 10.
Due to due to this issue I had to recreate the docker image using these commands
docker-machine rm default
docker-machine --native-ssh create -d virtualbox default
After that it has been working fine, except for one problem:
When the PC has gone to sleep and then wakes again, the docker commands can no longer connect. Example:
> docker images
An error occurred trying to connect: Get https://192.168.99.100:2376/v1.20/images/json:
dial tcp 192.168.99.100:2376: ConnectEx tcp: A connection attempt failed because the
connected party did not properly respond after a period of time, or established connection
failed because connected host has failed to respond.
However the docker-machine lists the machine as running:
> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM
default * virtualbox Running tcp://192.168.99.100:2376
I can also confirm in VirtualBox that the VM screen seems to be active.
I have tried starting and stopping the machine, but that does not help
C:\x> docker-machine stop default
C:\x> docker-machine start default
Starting VM...
Started machines may have new IP addresses. You may need to re-run the `docker-machine env` command.
C:\x> docker-machine env default --shell=powershell
Ironically, the last command hangs, so I never get any environment settings.
The only thing that helps is to restart the whole PC. But that should be unnecessary?
I have also posted this as an issue on the docker github repository,but that was closed. A related issue seems to be this one, but no workaround or solution has been posted for Windows.
After hous of fighting with VirtualBox + Docker Toolbox, I finally found the way, how to make Docker working again (even without restarting all the containers):
Wake up PC from sleep
Try docker images (won`t work)
Open VirtualBox -> Close VM with saving state (CTRL+V)
Run your VM again
Try docker images again (now should work)
Please note: All steps are in VirtualBox only! Running docker-machine restart default will create another host-only adapter, which is something you do not want. If you did it anyway, delete all additionally created adapters (File->Preferences->Network on VirtualBox), then follow steps 1-5.
I have experienced the exact same symptoms on Windows 8.1... The thing is that it's not really a docker-specific issue, but more how Windows manages the VirtualBox network adapters after sleep (I think...). The culprit in my case is that the network adapter's addresses were becoming private after sleep (they became 169.* addresses).
Credits to this guy who gave me the idea: http://lyngtinh.blogspot.ca/2011/12/how-to-disable-autoconfiguration-ipv4.html
Fix:
Start a command prompt as Administrator
Find out the "useful" network adapters: ipconfig /all. The useful ones in my case were the ones labeled "VirtualBox Host-Only Ethernet Adapter" that didn't have private ips (not starting with 169.*).
Run this command and note the "Idx" of the useful VirtualBox network adapters: netsh interface ipv4 show inter.
Run this command to disable the IP auto configuration: netsh interface ipv4 set interface <idx> dadtransmits=0 store=persistent. Replace <idx> with each index found in the previous step.
Restart Windows
Afterwards, I was able to docker-machine start default, then docker-machine env default --shell cmd, put the PC to sleep, wake up and run docker-machine env default --shell cmd again.
I found that removing 'host only adapter' (File->Preferences->Network on VirtualBox), and restart the docker-machine helps.
Not a real solution. But probably better over restart the computer.
Having tried all the other answers here, and having varying but not consistent success, the following seems to reliably bring it back for me after this problem occurs.
Open a powershell/command window (I have most success if I run all docker-machine commands in a powershell window opened as administrator, I don't know if that's important or not) then run (where "dev" is the name of your docker machine instance):
docker-machine ssh dev
Then on the terminal that is opened, run:
sudo shutdown -r now
When the machine restarts, it seems to refresh the network and work correctly. Note, however, that simply running docker-machine restart dev did not have the same effect for me.
Your machine needs to be running before you can do the ssh, so if it's not running, execute docker-machine start dev before trying to SSH.
Had the same problem on Windows 8.1 and docker toolbox 1.12.0
None of the above solutions worked for me, too.
[edited]
Found another way to make docker work after system wake up:
In the docker Quickstart Terminal window, stop docker process Ctrl-C (if it is still running)
Run command docker-compose down
Shut down docker with docker-machine stop default
Exit terminal window Ctrl-D
Run Quickstart Terminal again and do all subsequent steps you need.
This worked for me, on Windows host machine.
Configure your network adapter to
1) Allow the network adapter to wake the computer,
2) Allow a magic packet to wake the computer,
3) Allow IPV6
http://www.worldstart.com/dropped-internet-connection-in-sleep-mode/
Also, on virtual box network settings, go to advanced, and allow promiscuous mode to VM machines, or allow all

Resources