Skip to content

Fasten Minikube by Downloading the Cache

Yi Wang edited this page Jun 4, 2020 · 5 revisions

Minikube is important for developers to run a Kubernetes cluster locally. SQLFlow developers and end-users use it to run local deployment of the SQLFlow service.

Download and Install

At the time of writing, the most recent version of minikube is 1.11.0, which you can download from its official distribution site

curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64

or a mirror site

curl -Lo minikube http://cdn.sqlflow.tech/minikube/minikube-linux-1.11.0

The installation is simply moving it to a directory in the PATH environment variable.

chmod +x minikube
sudo mv minikube /usr/local/bin

Run a Local Cluster

Assuming that you are working in a Linux host (VM or bare metal) with Docker installed, you can start and run your local Kubernetes cluster using the following command.

minikube config set memory 8192  # Use more memory than the default.
minikube config set cpus 4       # Use more CPUs than the default.
minikube set vm-driver docker    # Use Docker containers than VirtualBox VMs.
minikube start                   # Start and run the local Kubernetes cluster.

Download and Cache Dependencies

However, the above process could be slow as minikube downloads necessary Docker images and other necessary files. If you have a slow Internet connection to the official distribution sites of the above files, you can alternatively download these files from a mirror site (if there is any) into your $HOME/.minikube/cache directory before running the minikube start command. This works because minikube tries to find cached files before downloading. An example checking is as follows:

https://github.com/kubernetes/minikube/blob/ecaaeaf99c6aa6fd8d4229b9b754854abc506159/pkg/minikube/download/preload.go#L100-L105

For the special case that

  • you want to run Kubernetes 1.18.3
  • on a Linux host (VM or bare metal)
  • with Docker installed

you can create the following directory hierarchy and download the required files from a mirror.

$HOME/.minikube/cache/
└── preloaded-tarball
    ├── preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4
    └── preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4.checksum

SQLFlow developers can download the above files from our development mirror.

export CACHE_SITE="http://cdn.sqlflow.tech/minikube/v1.18.3/cache"
mkdir -p $HOME/.minikube/cache/preloaded-tarball
cd $HOME/.minikube/cache/preloaded-tarball
curl -LO $CACHE_SITE/preloaded-tarball/preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4
curl -LO $CACHE_SITE/preloaded-tarball/preloaded-images-k8s-v3-v1.18.3-docker-overlay2-amd64.tar.lz4.checksum
Clone this wiki locally