This is an old revision of the document!
Overview
To install kubernetes or minikube in general, which is a taste of Kubernetes. You need to configuration the repository first. So let's configure the Repository, depending on the operation system. In our case we will use Ubuntu, but the installation will be pretty similiar on the distributions as well.
In a nutshell we have to:
- Install the GPG key
- Update the local Repo
- Install the kubectl
- Install the minikube
Config
Let's start the configuration one by one, firstly: Install the GPG key:
Install GPG key
Download the GPG Key
root@k8s-master:/etc/apt/sources.list.d# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - OK root@k8s-master:
Then we have to insert the repo details:
Insert Repo Location
root@k8s-master:/etc/apt/apt.conf.d# cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list deb https://apt.kubernetes.io/ kubernetes-xenial main EOF root@k8s-master:/etc/apt/apt.conf.d#
That command, will add the: “deb https://apt.kubernetes.io/ kubernetes-xenial main” string in the kuberenetes.list file.
Update local Repo
After that, we can update the local repo:
Update the local repo
root@k8s-master:/etc/apt/sources.list.d# apt-get update ***************************** Ign https://download.docker.com xenial/stable Translation-en Ign https://esm.ubuntu.com trusty-infra-updates/main Translation-en Ign https://download.docker.com trusty/stable Translation-en_US Ign https://download.docker.com trusty/stable Translation-en Reading package lists... Done
Install Kubectl & Minikube
We can check, if the installation has been correct as follows: Eventhough, we need only the kubectl, let's install the whole stack, since we will use it later, for the whole manual implementation:
Install the kubectl
root@k8s-master:/etc/apt/sources.list.d# apt-get install -y kubelet kubeadm kubectl kubernetes-cni Reading package lists... Done Building dependency tree Reading state information... Done ***************************** Processing triggers for libc-bin (2.19-0ubuntu6.15) ...
We can verify if the installation is complete by checking the version:
Check the kubectl
root@k8s-master:/etc/apt/sources.list.d# kubectl version --client Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"} root@k8s-master:/etc/apt/sources.list.d#
Install Driver
To install Minikube, we have to install a driver, so either: docker or rockat. I will go with a docker here:
Install Docker
root@k8s-master:/etc/apt# apt install docker.io Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: bridge-utils cgroupfs-mount containerd pigz runc ubuntu-fan Suggested packages: ifupdown aufs-tools debootstrap docker-doc rinse zfs-fuse | zfsutils The following NEW packages will be installed: bridge-utils cgroupfs-mount containerd docker.io pigz runc ubuntu-fan 0 upgraded, 7 newly installed, 0 to remove and 0 not upgraded. Need to get 63.8 MB of archives. After this operation, 319 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 pigz amd64 2.4-1 [57.4 kB] Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 bridge-utils amd64 1.5-15ubuntu1 [30.1 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 cgroupfs-mount all 1.4 [6320 B] Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 runc amd64 1.0.0~rc10-0ubuntu1~18.04.2 [2000 kB] Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 containerd amd64 1.3.3-0ubuntu1~18.04.1 [21.7 MB] Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 docker.io amd64 19.03.6-0ubuntu1~18.04.1 [39.9 MB] Get:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 ubuntu-fan all 0.12.10 [34.7 kB] Fetched 63.8 MB in 56s (1136 kB/s) Preconfiguring packages ... Selecting previously unselected package pigz. (Reading database ... 80853 files and directories currently installed.) Preparing to unpack .../0-pigz_2.4-1_amd64.deb ... Unpacking pigz (2.4-1) ... Selecting previously unselected package bridge-utils. Preparing to unpack .../1-bridge-utils_1.5-15ubuntu1_amd64.deb ... Unpacking bridge-utils (1.5-15ubuntu1) ... Selecting previously unselected package cgroupfs-mount. Preparing to unpack .../2-cgroupfs-mount_1.4_all.deb ... Unpacking cgroupfs-mount (1.4) ... Selecting previously unselected package runc. Preparing to unpack .../3-runc_1.0.0~rc10-0ubuntu1~18.04.2_amd64.deb ... Unpacking runc (1.0.0~rc10-0ubuntu1~18.04.2) ... Selecting previously unselected package containerd. Preparing to unpack .../4-containerd_1.3.3-0ubuntu1~18.04.1_amd64.deb ... Unpacking containerd (1.3.3-0ubuntu1~18.04.1) ... Selecting previously unselected package docker.io. Preparing to unpack .../5-docker.io_19.03.6-0ubuntu1~18.04.1_amd64.deb ... Unpacking docker.io (19.03.6-0ubuntu1~18.04.1) ... Selecting previously unselected package ubuntu-fan. Preparing to unpack .../6-ubuntu-fan_0.12.10_all.deb ... Unpacking ubuntu-fan (0.12.10) ... Setting up runc (1.0.0~rc10-0ubuntu1~18.04.2) ... Setting up cgroupfs-mount (1.4) ... Setting up containerd (1.3.3-0ubuntu1~18.04.1) ... Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service. Setting up bridge-utils (1.5-15ubuntu1) ... Setting up ubuntu-fan (0.12.10) ... Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /lib/systemd/system/ubuntu-fan.service. Setting up pigz (2.4-1) ... Setting up docker.io (19.03.6-0ubuntu1~18.04.1) ... Adding group `docker' (GID 116) ... Done. Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket. docker.service is a disabled or a static unit, not starting it. Processing triggers for systemd (237-3ubuntu10.39) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... Processing triggers for ureadahead (0.100.0-21) ... root@k8s-master:/etc/apt#
Finally we can install the Minicube and start it as follows:
Manual Minikube Installation
root@k8s-master:/etc/apt# curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \ > && chmod +x minikube % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 52.0M 100 52.0M 0 0 13.2M 0 0:00:03 0:00:03 --:--:-- 13.2M root@k8s-master:/etc/apt# mkdir -p /usr/local/bin/ root@k8s-master:/etc/apt# install minikube /usr/local/bin/
Once that is done, we can start it:
Start Minikube
root@k8s-master:/etc/apt# minikube start --vm-driver=none --apiserver-ips 127.0.0.1 --apiserver-name localhost 😄 minikube v1.9.0 on Ubuntu 18.04 ✨ Using the none driver based on existing profile 🤹 Running on localhost (CPUs=2, Memory=984MB, Disk=9861MB) ... ℹ️ OS release is Ubuntu 18.04.4 LTS 🐳 Preparing Kubernetes v1.18.0 on Docker 19.03.6 ... ▪ kubelet.resolv-conf=/run/systemd/resolve/resolv.conf > kubectl.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s > kubelet.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s > kubeadm.sha256: 65 B / 65 B [--------------------------] 100.00% ? p/s 0s > kubectl: 41.98 MiB / 41.98 MiB [----------------] 100.00% 5.70 MiB p/s 8s > kubeadm: 37.96 MiB / 37.96 MiB [----------------] 100.00% 4.68 MiB p/s 8s > kubelet: 108.01 MiB / 108.01 MiB [-------------] 100.00% 9.19 MiB p/s 12s 🌟 Enabling addons: default-storageclass, storage-provisioner 🤹 Configuring local host environment ... ❗ The 'none' driver provides limited isolation and may reduce system security and reliability. ❗ For more information, see: 👉 https://minikube.sigs.k8s.io/docs/reference/drivers/none/ ❗ kubectl and minikube configuration will be stored in /root ❗ To use kubectl or minikube commands as your own user, you may need to relocate them. For example, to overwrite your own settings, run: ▪ sudo mv /root/.kube /root/.minikube $HOME ▪ sudo chown -R $USER $HOME/.kube $HOME/.minikube 💡 This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true E0330 14:07:45.754288 18287 kubeadm.go:346] Overriding stale ClientConfig host https://localhost:8443 with https://10.0.2.15:8443 🏄 Done! kubectl is now configured to use "minikube" 💡 For best results, install kubectl: https://kubernetes.io/docs/tasks/tools/install-kubectl/ root@k8s-master:/etc/apt