diff --git a/kubernetes_installation.md b/kubernetes_installation.md index 3bd3a1e035a6650b6a7b8c1bc832a58e79dc6a6c..3febef8ee5ee1a724df806105c1009cfc2f623a1 100644 --- a/kubernetes_installation.md +++ b/kubernetes_installation.md @@ -46,6 +46,7 @@ Vérification : ```bash free -h ``` +verifier si la colonne echange est bien a 0. ## 4. Configuration Système pour Kubernetes @@ -59,6 +60,7 @@ EOF modprobe overlay modprobe br_netfilter +echo -e overlay\\nbr_netfilter > /etc/modules-load.d/k8s.conf cat <<EOF | tee /etc/sysctl.d/99-kubernetes-k8s.conf net.bridge.bridge-nf-call-iptables = 1 @@ -68,12 +70,39 @@ EOF sysctl --system ``` +Cela va permettre de charger les modules necessaires au fonctionnement de kubernetes ## 5. Installation de Containerd ```bash -apt -y install containerd +apt -y install containerd iptables apt-transport-https gnupg2 curl sudo containerd config default | tee /etc/containerd/config.toml >/dev/null 2>&1 +nano /etc/containerd/config.toml +``` + +Il faut par la suite modifier le fichier a la ligne 61 : +```bash +sandbox_image = "registry.k8s.io/pause:3.9" +``` +et ligne 125 : +```bash +SystemdCgroup = true +``` + +Puis redemarrer le service : +```bash +systemctl restart containerd.service +``` + +## 6. passer sur iptables legacy + +- Il faut passer sur la regle iptables-legacy : +```bash +Selection Path Priority Status +------------------------------------------------------------ +* 0 /usr/sbin/iptables-nft 20 auto mode + 1 /usr/sbin/iptables-legacy 10 manual mode + 2 /usr/sbin/iptables-nft 20 manual mode ``` ## 6. Installation de Kubernetes (Kubeadm, Kubelet, Kubectl) @@ -88,7 +117,7 @@ ln -s /opt/cni/bin /usr/lib/cni ## 7. Initialisation du Cluster Kubernetes -Sur **le master (kube01)** : +Sur **le master (kube01) UNIQUEMENT** : ```bash kubeadm init --control-plane-endpoint=192.168.10.10 --pod-network-cidr=10.244.0.0/16 @@ -96,18 +125,39 @@ kubeadm init --control-plane-endpoint=192.168.10.10 --pod-network-cidr=10.244.0. Post-initialisation : +- Apres l'initiation du master, nous avons ce message qu'il faut conserver : ```bash -mkdir -p $HOME/.kube -cp -i /etc/kubernetes/admin.conf $HOME/.kube/config -chown $(id -u):$(id -g) $HOME/.kube/config -``` +Your Kubernetes control-plane has initialized successfully! + +To start using your cluster, you need to run the following as a regular user: + + mkdir -p $HOME/.kube + sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config + sudo chown $(id -u):$(id -g) $HOME/.kube/config + +Alternatively, if you are the root user, you can run: + + export KUBECONFIG=/etc/kubernetes/admin.conf + +You should now deploy a pod network to the cluster. +Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: + https://kubernetes.io/docs/concepts/cluster-administration/addons/ -Si root : +Then you can join any number of worker nodes by running the following on each as root: +kubeadm join 192.168.10.10:6443 --token 9yu8eq.hluhrzkufar4s07z \ + --discovery-token-ca-cert-hash sha256:21820cff2482dda0ce25e234f5fc2e6a5d2676bd14ca08cf1c457eba2a3583b2 + +``` + +Mise en place des droits du cluster pour l'admin : ```bash -export KUBECONFIG=/etc/kubernetes/admin.conf +mkdir -p $HOME/.kube +cp -i /etc/kubernetes/admin.conf $HOME/.kube/config +chown $(id -u):$(id -g) $HOME/.kube/config ``` + ## 8. Ajout des Workers Sur **chaque worker** :