Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Kubernetes on mac with vagrant and virtualbox

This is my first attempt to install and use Kubernetes. I am trying to install an environment on Mac for developing my own apps and deploying them for test locally with Kubernetes. I am familiar with using Vagrant, VirtualBox and Docker for the same purpose. When I saw this page https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/getting-started-guides/vagrant.md I assumed it would be trivial. I executed these lines:

export KUBERNETES_PROVIDER=vagrant
curl -sS https://get.k8s.io | bash

This created a master VM and a Minion, but Kubernetes seems to have failed to start on the master. On the master /var/log/salt/master is full of python Traceback errors, like this:

2015-07-17 22:14:42,629 [cherrypy.error   ][INFO    ][3252] [17/Jul/2015:22:14:42] ENGINE Started monitor thread '_TimeoutMonitor'.
2015-07-17 22:14:42,736 [cherrypy.error   ][ERROR   ][3252] [17/Jul/2015:22:14:42] ENGINE Error in HTTP server: shutting down
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/process/servers.py", line 187, in _start_http_thread
self.httpserver.start()
  File "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py", line 1824, in start
    raise socket.error(msg)
error: No socket could be created

Vagrant is version 1.7.3. VirtualBox is version 4.3.30

Have I made an obvious stupid mistake?

like image 536
Martin Nally Avatar asked Jul 17 '15 22:07

Martin Nally


People also ask

Can we install Kubernetes on Mac?

Kubernetes is available in Docker for Mac for 18.06 Stable or higher and includes a Kubernetes server and client, as well as integration with the Docker executable. The Kubernetes server runs locally within your Docker instance and it is similar to the Docker on Windows solution.

Can I install Kubernetes on virtual machines?

In 2019, VMware started supporting Kubernetes as part of its vSphere virtualization platform, which includes the ESXi hypervisor. It is now possible to run containers directly on ESXi, or use the Tanzu Kubernetes Grid platform to manage standard Kubernetes clusters, compatible with upstream Kubernetes development.


1 Answers

I don't yet know the fix but I know what is going wrong since it happens to me as well:

  • OS X 10.10.3
  • Vagrant 1.7.4
  • VirtualBox 4.3.30
  • Kubernetes 1.0.1

When I run the default configuration of this (which creates one "master" and one "minion" VM) I see that the static IP address is not being assigned to the "eth1" interface, and I also see that the Salt API server is sitting in what appears to be an infinite retry loop because it is trying to listen on that IP address.

Also, the following message happened during boot:

[vagrant@kubernetes-master ~]$ dmesg | grep eth1
[    9.321496] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready

So basically, the static IP address didn't get assigned because eth1 wasn't ready when the system first booted, and Salt is waiting for it to get assigned.

I could fix this after boot by sshing to the box using "vagrant ssh" and running the command:

sudo /etc/init.d/network restart

on each host.

This "fixes" eth1 by assigning the static IP address, and after that Salt begins to do its thing, installs Docker, boots various containers, and so on.

What I don't know is how to make this work every time without manual intervention. It appears to be some sort of a race condition between Vagrant and VirtualBox.

like image 79
Greg Brail Avatar answered Sep 30 '22 05:09

Greg Brail