Skip to content

Instantly share code, notes, and snippets.

@scottrigby
Last active July 16, 2017 17:15
Show Gist options
  • Select an option

  • Save scottrigby/0d5e79afbc00a3650f043cb7d380080d to your computer and use it in GitHub Desktop.

Select an option

Save scottrigby/0d5e79afbc00a3650f043cb7d380080d to your computer and use it in GitHub Desktop.
⛔️ [DEPRECATED] Minikube + xhyve workaround
#! /bin/bash
# Minikube 0.19 has some issues with with xhyve driver after stop. Workaround.
xhyve_minikube_start() {
# Require the administrator password upfront. If the user already has a sudo
# session, sudo validate here will not prompt again, but will silently succeed.
sudo -v
if [ $? == 1 ]; then
echo 'You must enter an administrative password to use this script.'
exit 1
fi
which brew &> /dev/null
if [ $? == 1 ]; then
# homebrew is not installed. Do it.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew cask list minikube &> /dev/null
if [ $? == 1 ]; then
# minikube cask is not installed. Do it.
# ref: https://github.com/kubernetes/minikube#macos
brew cask install minikube
fi
brew list docker-machine-driver-xhyve &> /dev/null
if [ $? == 1 ]; then
# xhyve driver is not installed. Do it.
# ref: https://github.com/kubernetes/minikube/blob/master/DRIVERS.md#xhyve-driver
brew install docker-machine-driver-xhyve
fi
# If we remove ~/.minikube while minikube is running, we get to a dirty
# minikube state, and would be forced to `minikube delete`. So stop it first.
minikube stop
# ref: https://github.com/kubernetes/minikube/issues/307#issuecomment-295243637
# ref: https://github.com/zchee/docker-machine-driver-xhyve/issues/156#issuecomment-300051049
sudo rm -rf ~/.minikube
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
# This also sets kuberentes cluster congtext to 'minikube'.
minikube start --vm-driver xhyve
}
xhyve_minikube_start
@scottrigby
Copy link
Author

@sampowers Hey that's much more robust (a much larger scope than mine here).

Luckily the xhyve driver issue has been resolved as of the latest version of docker-machine-driver-xhyve: https://github.com/zchee/docker-machine-driver-xhyve/releases/tag/v0.3.3

Deprecating this gist 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment