Outils pour utilisateurs

Outils du site


informatique:minikube

Minikube

Prérequis

Il faut tout d'abord installer Docker :

$ sudo apt update
 
$ sudo apt install apt-transport-https ca-certificates software-properties-common curl
 
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
OK
 
$ sudo add-apt-repository \
    "deb [arch=armhf] https://download.docker.com/linux/ubuntu \
    $(lsb_release -cs) \
    stable"
 
$ sudo apt update 
 
$ sudo apt install docker-ce
 
$ docker --version
Docker version 18.06.1-ce, build e68fc7a

Configurer le service :

$ sudo systemctl enable docker
Synchronizing state of docker.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable docker
 
$ sudo systemctl start docker
 
$ sudo systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-10-25 17:03:35 CEST; 1s ago
     Docs: https://docs.docker.com
 Main PID: 24001 (dockerd)
    Tasks: 42
   CGroup: /system.slice/docker.service
           ├─24001 /usr/bin/dockerd -H fd://
           └─24025 docker-containerd --config /var/run/docker/containerd/containerd.toml
 
(...)

Il faut aussi installer kubectl :

$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
OK
 
$ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
deb http://apt.kubernetes.io/ kubernetes-xenial main
 
$ sudo apt update
 
$ sudo apt-get install -y kubectl

Installation de Minikube

$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
    && sudo install minikube-linux-amd64 /usr/local/bin/minikube
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 40.3M  100 40.3M    0     0   646k      0  0:01:03  0:01:03 --:--:--  674k

Erreurs rencontrées

Si on a déjà une configuration kubectl, ça coince :

# minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
 170.78 MB / 170.78 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.0
Downloading kubelet v1.10.0
Finished Downloading kubelet v1.10.0
Finished Downloading kubeadm v1.10.0
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
E1025 17:12:58.574474   24198 start.go:289] Error setting up kubeconfig:  writing kubeconfig: Error writing file : open : no such file or directory
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
	minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]: 

Si on a pas installé virtualbox, ça coince :

$ sudo minikube start 
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Downloading Minikube ISO
 170.78 MB / 170.78 MB [============================================] 100.00% 0s
E1025 17:33:25.661999     822 start.go:168] Error starting host: Error creating host: Error executing step: Running precreate checks.
: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path.
 
 Retrying.
E1025 17:33:25.662215     822 start.go:174] Error starting host:  Error creating host: Error executing step: Running precreate checks.
: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
	minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]: 

J'ai eu une autre erreur où il me dit de faire un minikube delete suivi d'un minikube start (et où il se plaint déjà d'un problème de permissions…

$ minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E1115 14:54:06.331331   30870 start.go:168] Error starting host: Error loading existing host. Please try running [minikube delete], then run [minikube start] again.: Error loading host from store: open /home/simon/.minikube/machines/minikube/config.json: permission denied.
 
 Retrying.
E1115 14:54:06.331499   30870 start.go:174] Error starting host:  Error loading existing host. Please try running [minikube delete], then run [minikube start] again.: Error loading host from store: open /home/simon/.minikube/machines/minikube/config.json: permission denied
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
    minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]:   

J'essaye de faire le minikube delete comme conseillé.

$ minikube delete
Deleting local Kubernetes cluster...
Errors occurred deleting machine:  Error deleting host: minikube: Error loading host from store: open /home/simon/.minikube/machines/minikube/config.json: permission denied

Encore un problème de permissions… C'est quoi les permissions sur ce dossier ?

$ ls -al /home/simon/.minikube/
drwxr-xr-x    - root 25 oct 17:03 addons
.rw-r--r-- 1,3k root 25 oct 17:12 apiserver.crt
.rw------- 1,7k root 25 oct 17:12 apiserver.key
.rw-r--r-- 1,1k root 25 oct 17:12 ca.crt
.rw------- 1,7k root 25 oct 17:12 ca.key
.r----x--x 1,0k root 25 oct 17:08 ca.pem
drwxr-xr-x    - root 25 oct 17:08 cache
.r----x--x 1,1k root 25 oct 17:08 cert.pem
drwxr-xr-x    - root 25 oct 17:08 certs
.rw-r--r-- 1,1k root 25 oct 17:12 client.crt
.rw------- 1,7k root 25 oct 17:12 client.key
drwxr-xr-x    - root 25 oct 17:03 config
drwxr-xr-x    - root 25 oct 17:03 files
.r----x--x 1,7k root 25 oct 17:08 key.pem
drwxr-xr-x    - root 25 oct 17:03 logs
drwxr-xr-x    - root 25 oct 17:08 machines
drwx------    - root 25 oct 17:08 profiles
.rw-r--r-- 1,1k root 25 oct 17:12 proxy-client-ca.crt
.rw------- 1,7k root 25 oct 17:12 proxy-client-ca.key
.rw-r--r-- 1,1k root 25 oct 17:12 proxy-client.crt
.rw------- 1,7k root 25 oct 17:12 proxy-client.key

Résolution et lancement de minikube

Les permissions étaient en root partout ! C'est pour ça que ça coinçait !

$ sudo chown -R simon:simon /home/simon/.minikube/
 
$ minikube start
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

Yes! Minikube est lancé !

informatique/minikube.txt · Dernière modification : 2020/08/09 13:03 de 127.0.0.1