Unable to start minikube in windows using hyperv - windows

I installed minikube successfully on my windows machine and was using it. All of a sudden minikube start command failed to work one day, so I force-deleted .minikube directory and also removed minikube from Hyper-V Manager on Windows.
After this, I am unable to create/start minikube on my windows machine. I can see that a VM is created in Hyper-V manager but minikube is not starting with below error.
minikube start --vm-driver=hyperv
* minikube v1.5.2 on Microsoft Windows 10 Enterprise 10.0.17763 Build 17763
* Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.
* Using the running hyperv "minikube" VM ...
* Waiting for the host to be provisioned ...
X minikube is unable to connect to the VM: dial tcp: address fe80::215:5dff:fe01:90b:22: too many colons in address
I came across this link which seems to be fixed long ago.
https://github.com/kubernetes/minikube/issues/576
Can any one suggest other way to fix this ?

It's trying to append the port to the ip address, but is formatting incorrectly when the IP Address is IPv6 Github Issue. Looks like there have been similar issues in the past and the solution has been to try again on a later version.
If you can force the VM to have an ipv4 address, that may work around this issue (hyper-V settings?)

Related

What are the vm-driver and driver falgs in Minikube?

I am using Minikube in macOS.
I found this in ~/.minikube/config/config.json:
{
"driver": "docker",
"vm-driver": "hyperkit"
}
What are they, and what is the difference?
Does Minikube use Hyperkit as a virtual machine and run in it? If so, why do it needs the driver settings?
Also, I see a lot of minikube start with:
--docker-env http_proxy=url
--docker-env https_proxy=url
--docker-env no_proxy=url
there are the proxy settings in the docker settings (that is, the proxy settings in the dashboard in docker desktop for mac), are these parameters not needed if the driver is set to docker?
And does the proxy in docker refer to the network environment in hyperkit? Because I think docker pull and push are done in docker daemon, which is running on hyperkit.
I also was confused about the difference betwenn --vm-driver and --driver, and I found that --vm-driver is the old name and it is deprecated, and today --driver is the correct option
Any environment set using --docker-env will go to the docker daemon service. And vm-driver is which hypervisor to use. If you run minikube start --help you will find below information
--driver='': Driver is one of: virtualbox, parallels, vmwarefusion, hyperkit, vmware, docker, podman
So you can use any of above drivers to start your k8s cluster.

No services for minikube windows "No connection could be made because the target machine actively refused it."

I have installed minikube via chocolatey on my windows 10 machine
I am using virtualbox for the VM
I have done minikube start and it is successful
Sporadically minikube status says that everything is running.
Usually, after I have started, the cluster is stopped.
I have disconnected from the VPN, restarted the computer, disconnected and reconnected to the internet, upgraded dropbox.
minikube service list returns either:
Get https://10.100.99.100:8443/api/v1/services: dial tcp 10.100.99.100:8443: connectex: No connection could be made because the target machine actively refused it.
Check that minikube is running and that you have specified the correct namespace (-n flag) if required.
Or
|-----------|------------|--------------|
| NAMESPACE | NAME | URL |
|-----------|------------|--------------|
| default | kubernetes | No node port |
|-----------|------------|--------------|
I have started with multiple different commands:
minikube start --vm-driver "virtualbox" --memory 8192 --disk-size 40g --host-only-cidr "10.100.99.1/24" being the most recent.
I have deleted and removed all machine files and then used the start command again to recreate the machine.
I have updated my config.json file to ensure that all slashes are "windows" slashes
I am completely at a loss for how to get this thing running.
I got this error after my setup was running fine and I had to restart my Windows 7 machine.
Is your docker VM running as expected?
If not, $docker-machine stop default
Followed by $docker-machine start default
minikube start --docker-env HTTP_PROXY=http://$YOURPROXY:PORT \ --docker-env HTTPS_PROXY=https://$YOURPROXY:PORT
Figure out if you are being blocked by a corporate proxy: https://superuser.com/questions/346372/how-do-i-know-what-proxy-server-im-using
The method using Chrome is the easiest

Docker and Windows - Problems with SSH on default container

i'm new to Docker and i've just intalled Docker ToolBox 1.11.1 on my Windows 7 (64 bit).
When running Quickstart Terminal i've got problems with creating default container.
After reading a bunch of forums i've invoked :
docker-machine rm -f default
docker-machine --debug create -d virtualbox default
But still without result. Full logs from last operation are :
https://gist.github.com/anonymous/117e302c047492170a6f0c7d4e79199a
They end up with phrase :
"(default) DBG | Error dialing TCP: dial tcp 127.0.0.1:49659: connectex: No connection could be made because the target machine actively refused it."
I've have no idea how to fix that. Can someone help me ?
In windows and Mac OS Docker run in a virtual machine. When you install Docker using the Docker Toolbox, it takes care of install Virtual Box, create a “default” virtual machine and configure it to run a Boot2Docker image.
With the command:
docker-machine rm -f default
you are removing this default VM. Then running the command:
docker-machine --debug create -d virtualbox default
you are creating a new VM called “default”, so you are not creating or starting any default windows container.
"Actively refused it" means that the host sent a reset instead of an ack when you tried to connect. Please, check the firewall or the proxy configuration because this is a communication problem.
Hope this can help.

Error setting up docker on Windows

I am trying to set up docker machine on Windows and this problem has annoyed me for a few days.
I downloaded and installed DockerToolbox-1.9.1a on my Windows, so it came with Virtual Box version 5.0.10. After that I ran this command to create my virtual machine:
docker-machine create --driver virtualbox --engine-insecure-registry docker.pre-prod.ss.local:5000 --virtualbox-hostonly-cidr 192.168.99.100/24 mymachine
Here is what I got:
Waiting for machine to be running, this may take a few minutes...
Machine is running, waiting for SSH to be available... Detecting
operating system of created instance... Detecting the provisioner...
Provisioning created instance... Copying certs to the local machine
directory... Copying certs to the remote machine... Setting Docker
configuration on the remote daemon... WARNING >>> This machine has
been allocated an IP address, but Docker Machine could not reach it
successfully.
SSH for the machine should still work, but connecting to exposed
ports, such as the Docker daemon port (usually :2376), may not
work properly.
You may need to add the route manually, or use another related
workaround
This could be due to a VPN, proxy, or host file configuration issue.
You also might want to clear any VirtualBox host only interfaces you
are not using
The machine was created successfully. So I ran the docker-machine env command:
docker-machine env --shell=powershell mymachine| Invoke-Expression
and I got:
Error running connection boilerplate: Error checking and/or
regenerating the certs: There was icates for host
"192.168.99.100:2376": dial tcp 192.168.99.100:2376: connectex: No
connection target machine actively refused it. You can attempt to
regenerate them using 'docker-machine regenerate-certs name'. Be
advised that this will trigger a Docker daemon restart which will stop
running containers.
Running docker version returned
Client: Version: 1.9.1 API version: 1.21 Go version:
go1.4.3 Git commit: a34a1d5 Built: Fri Nov 20 17:56:04 UTC
2015 OS/Arch: windows/amd64 An error occurred trying to connect:
Get http://localhost:2375/v1.21/version: dial tcp connection could be
made because the target machine actively refused it.
Can someone help to point out the direction to fix this issue? It is really troublesome to set up docker on Windows. Thank you very much.
I use docker 1.9.1 on Windows (7, 8 and even 10), but without docker registry, and without using --virtualbox-hostonly-cidr.
If you are to use that last option, check "Set a specific address ip when i create a docker container", where I mention issue 1709, which uses cidr in .1, not .100 (but getting a .100 ip address as a result):
docker-machine create -d virtualbox --virtualbox-hostonly-cidr "192.168.99.1/24" m99
If there's no other machine with the same cidr (Classless Inter-Domain Routing), the machine should always get the .100 IP upon start.

How to bind the VM docker-machine creates to OSX IP address?

I'm developing locally with Docker on OSX using the latest Docker toolkit. I have a node server running in a docker container, bound to port 9999 of the VM. I can hit this server from a browser on my mac, and I would like to hit from another device on the same network. Is there a way to bind the VM to the machine's IP address? Or otherwise expose it?
I just figured this one out today! I am using docker-machine with virtualbox on Mac OS 10.10.5. The first thing I tried was to change the network interface from NAT to Bridged. This just breaks docker-machine's ability to communicate with the VM.
Instead I ADDED another network adapter running in bridged mode.
After starting the docker-machine I get this:
$ docker-machine ip redis-test
10.222.11.242
That is a local network address accessible from anyone else in my office or on my VPN.
Then if I run something like:
$ docker run -p 6379:6379 -d redis
I get a containerized redis service running on port 6379 of the 10.222.11.242 address.
So I can do this from anywhere else on the network:
$ telnet 10.222.11.242 6379
Trying 10.222.11.242...
Connected to 10.222.11.242.
Escape character is '^]'.
info
$1827
# Server
redis_version:2.8.19
...
And as a cool bonus of this we can remap the ports like this:
$ docker run -p 8080:6379 -d redis
e7cc53d9c157a658041c3bee5967dd3678b4d35e6146a02220a87bfebfc919ad
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e7cc53d9c157 redis "/entrypoint.sh redis" 7 seconds ago Up 6 seconds 0.0.0.0:8080->6379/tcp goofy_yonath
bf1dc6c7c6b5 redis "/entrypoint.sh redis" 51 minutes ago Up 51 minutes 0.0.0.0:6379->6379/tcp redis
Now I have two redis instances listening on different ports (6379 and 8080) of the same IP.
EDIT: Here are some details to help those confused about adding a NIC to the VM in VirtualBox. I have only used VirtualBox for this and cannot advise about other virtualization system configurations.
Stop the VM by selecting it in the VM Manager and using the right-click menu or pressing 'command-F'.
Click "Settings".
Click "Network".
Select one of the Adapters that is not currently enabled.
Enable it.
Select "Bridged Adapter" in the "Attached to" selection.
Click OK.
Start your VM and try it out.
NOTE: I am sure there are some clever command line options for doing this setup, but since I only ever needed to set it once I have never bothered to automate it.
You could setup port forwarding on the VirtualBox NAT adaptor.
Bridging it to the local network (in the answer above) is not the same as using the OSX IP address. Bridging can sometimes cause extra headaches if you are on laptop and move to different internet connections. The VM may not automatically pull a new IP from the new network, etc.
In the UI go to Settings --> Network --> Port Forwarding or from the commandline something like this:
VBoxManage controlvm "default" natpf1 "tcp-port9999,tcp,,9999,,9999";
where "default" is the name of the VM ("default" is normally used for docker-machine) and 9999 is the port you want to map.
More info at: https://github.com/boot2docker/boot2docker/blob/master/doc/WORKAROUNDS.md
https://www.virtualbox.org/manual/ch06.html (Configuring Port forwarding with NAT)
Did you put the expose command in Dockerfile?
EXPOSE 9999
Based on #e.thompsy answer, here is the command line version.
First, figure out the interface name you need using:
vboxmanage list bridgedifs
For me it was en1.
Then:
docker-machine create ...
docker-machine stop $VM
vboxmanage modifyvm "$VM" --nic3 bridged --bridgeadapter3 en1
docker-machine start $VM

Resources