Table des matières

Kubernetes

Créer un cluster avec rke

Prérequis :

Installation de rke

$ wget https://github.com/rancher/rke/releases/download/v0.1.11/rke_linux-amd64
 
$ mv rke_linux-amd64 rke
 
$ chmod +x rke 
 
$ sudo cp rke /usr/bin/
 
$ rke
NAME:
   rke - Rancher Kubernetes Engine, an extremely simple, lightning fast Kubernetes installer that works everywhere
(...)

Créer une configuration de cluster avec rke

(source: hackernoon.com)

$ rke config
[+] Cluster Level SSH Private Key Path [~/.ssh/id_rsa]: ~/.ssh/id_ed25519
[+] Number of Hosts [1]: 2
[+] SSH Address of host (1) [none]: 192.168.1.101
[+] SSH Port of host (1) [22]: 1803
[+] SSH Private Key Path of host (192.168.1.101) [none]: 
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host (192.168.1.101) [none]: 
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_ed25519
[+] SSH User of host (192.168.1.101) [ubuntu]: simon
[+] Is host (192.168.1.101) a Control Plane host (y/n)? [y]: y
[+] Is host (192.168.1.101) a Worker host (y/n)? [n]: y
[+] Is host (192.168.1.101) an etcd host (y/n)? [n]: y
[+] Override Hostname of host (192.168.1.101) [none]: 
[+] Internal IP of host (192.168.1.101) [none]: 
[+] Docker socket path on host (192.168.1.101) [/var/run/docker.sock]: 
[+] SSH Address of host (2) [none]: 192.168.1.100
[+] SSH Port of host (2) [22]: 1803
[+] SSH Private Key Path of host (192.168.1.100) [none]: 
[-] You have entered empty SSH key path, trying fetch from SSH key parameter
[+] SSH Private Key of host (192.168.1.100) [none]: 
[-] You have entered empty SSH key, defaulting to cluster level SSH key: ~/.ssh/id_ed25519
[+] SSH User of host (192.168.1.100) [ubuntu]: simon
[+] Is host (192.168.1.100) a Control Plane host (y/n)? [y]: y
[+] Is host (192.168.1.100) a Worker host (y/n)? [n]: y
[+] Is host (192.168.1.100) an etcd host (y/n)? [n]: y
[+] Override Hostname of host (192.168.1.100) [none]: 
[+] Internal IP of host (192.168.1.100) [none]: 
[+] Docker socket path on host (192.168.1.100) [/var/run/docker.sock]: 
[+] Network Plugin Type (flannel, calico, weave, canal) [canal]: 
[+] Authentication Strategy [x509]: 
[+] Authorization Mode (rbac, none) [rbac]: 
[+] Kubernetes Docker image [rancher/hyperkube:v1.11.3-rancher1]: 
[+] Cluster domain [cluster.local]: 
[+] Service Cluster IP Range [10.43.0.0/16]: 10.100.0.0/16
[+] Enable PodSecurityPolicy [n]: 
[+] Cluster Network CIDR [10.42.0.0/16]: 10.110.0.0/16
[+] Cluster DNS Service IP [10.43.0.10]: 10.100.0.10
[+] Add addon manifest URLs or YAML files [no]: 

Ça crée un fichier ( cluster.yml ), reprenant toutes ces informations.

Avant de déployer

Il faut faire un swapoff sur les hosts :

$ sudo swapoff -a

Il faut vérifier qu'on peut accéder aux hosts avec une clé SSH.