Skip to content
Snippets Groups Projects
Commit 8f932c97 authored by CLEMENTE Damien's avatar CLEMENTE Damien
Browse files

Update file kubernetes_installation.md

parent 036b1333
Branches
No related tags found
No related merge requests found
...@@ -46,6 +46,7 @@ Vérification : ...@@ -46,6 +46,7 @@ Vérification :
```bash ```bash
free -h free -h
``` ```
verifier si la colonne echange est bien a 0.
## 4. Configuration Système pour Kubernetes ## 4. Configuration Système pour Kubernetes
...@@ -59,6 +60,7 @@ EOF ...@@ -59,6 +60,7 @@ EOF
modprobe overlay modprobe overlay
modprobe br_netfilter modprobe br_netfilter
echo -e overlay\\nbr_netfilter > /etc/modules-load.d/k8s.conf
cat <<EOF | tee /etc/sysctl.d/99-kubernetes-k8s.conf cat <<EOF | tee /etc/sysctl.d/99-kubernetes-k8s.conf
net.bridge.bridge-nf-call-iptables = 1 net.bridge.bridge-nf-call-iptables = 1
...@@ -68,12 +70,39 @@ EOF ...@@ -68,12 +70,39 @@ EOF
sysctl --system sysctl --system
``` ```
Cela va permettre de charger les modules necessaires au fonctionnement de kubernetes
## 5. Installation de Containerd ## 5. Installation de Containerd
```bash ```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 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) ## 6. Installation de Kubernetes (Kubeadm, Kubelet, Kubectl)
...@@ -88,7 +117,7 @@ ln -s /opt/cni/bin /usr/lib/cni ...@@ -88,7 +117,7 @@ ln -s /opt/cni/bin /usr/lib/cni
## 7. Initialisation du Cluster Kubernetes ## 7. Initialisation du Cluster Kubernetes
Sur **le master (kube01)** : Sur **le master (kube01) UNIQUEMENT** :
```bash ```bash
kubeadm init --control-plane-endpoint=192.168.10.10 --pod-network-cidr=10.244.0.0/16 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. ...@@ -96,18 +125,39 @@ kubeadm init --control-plane-endpoint=192.168.10.10 --pod-network-cidr=10.244.0.
Post-initialisation : Post-initialisation :
- Apres l'initiation du master, nous avons ce message qu'il faut conserver :
```bash ```bash
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 mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config
```
Si root : Alternatively, if you are the root user, you can run:
```bash
export KUBECONFIG=/etc/kubernetes/admin.conf 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/
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
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 ## 8. Ajout des Workers
Sur **chaque worker** : Sur **chaque worker** :
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment