Skip to content

Instantly share code, notes, and snippets.

@cchudant
Last active April 16, 2021 14:21
Show Gist options
  • Save cchudant/69d9cd2ca5dc4f51731e1730dd224e0e to your computer and use it in GitHub Desktop.
Save cchudant/69d9cd2ca5dc4f51731e1730dd224e0e to your computer and use it in GitHub Desktop.

Here is how to install Kubernetes on the computers at 42.

Install brew

If you do not have brew installed, install it with:

rm -rf $HOME/.brew && git clone --depth=1 https://github.com/Homebrew/brew $HOME/.brew && \
  echo 'export PATH=$HOME/.brew/bin:$PATH' >> $HOME/.zshrc && \
  source $HOME/.zshrc && \
  brew update

Note: this modifies your ~/.zshrc

Install minikube

Minikube is what you will use to manage your cluster. It will launch a virtual machine and run a master node and a worker node.

brew install minikube

Start minikube in /goinfre

Minikube will use a lot of disk space and resources, so you won't be able to start it in your home partition. We will make it launch in /goinfre.

Minikube will create its virtual machine on ~/.minikube so you just have to create a symbolic link, so that ~/.minikube points to /goinfre/(your-username)/.minikube

mkdir /goinfre/$USER
mkdir /goinfre/$USER/.minikube
ln -s /goinfre/$USER/.minikube ~/.minikube

There you go! You have installed minikube on your computer. You can now use minikube start --vm-driver=virtualbox to start your cluster!

Note: /goinfre is not a network patition; meaning anything installed on a computer will stay on this computer.

You should also add these lines in your ~/.zshrc:

[ -d /goinfre/$USER ] || mkdir /goinfre/$USER
[ -d /goinfre/$USER/.minikube ] || mkdir /goinfre/$USER/.minikube

These lines will automatically create the directories needed to run minikube on any computer.

Add more resources

If you are currently doing ft_services, there will be a point at which your cluster runs out of resources because of how many services the subject wants you to run.

You can give more resources to the virtual machine when starting the cluster:

minikube start --vm-driver=virtualbox --cpus 3 --memory=3000mb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment