add k8s tutos in devops guides
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Grégory Lebreton 2025-09-19 14:44:25 +02:00
parent bab730175a
commit ebee02c8bd
6 changed files with 98 additions and 0 deletions

View File

@ -7,3 +7,4 @@
- [Utiliser l'API de Gitlab / Github avec Bash](git-api.md) - [Utiliser l'API de Gitlab / Github avec Bash](git-api.md)
- [Développer des modules pour Odoo](odoo/index.md) - [Développer des modules pour Odoo](odoo/index.md)
- [Déployer son site web / hugo via le garage CICD](cicd.md) - [Déployer son site web / hugo via le garage CICD](cicd.md)
- [Utiliser Kubernetes](k8s/index.md)

View File

@ -0,0 +1,8 @@
# Guide Kubernetes
<img src="https://raw.githubusercontent.com/kubernetes/kubernetes/refs/heads/master/logo/logo.svg" style="width: 300px; text-align: center;">
- [Installation d'un cluster [K3S]() sur sa machine](installation.md)
- [Installation d'un cluster sur des raspberry pi](raspberry.md)
- [Monitorer son cluster avec [OpenLens]()](monitoring.md)

View File

@ -0,0 +1,29 @@
# Installer k3s sur sa machine locale
<a href="https://k3s.io"><img src="https://k3s.io/img/k3s-logo-light.svg" style="width: 300px; text-align: center;"></a>
## Installation
```bash
curl -sfL https://get.k3s.io | sh -
```
## Utilisation
- Installer `kubectl`
```bash
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
```
- Récupérer la config du cluster pour kubeclt
```bash
mv ~/.kube/config ~/.kube/config.BAK
cat /etc/rancher/k3s/k3s.yaml > ~/.kube/config
```
## Principales commandes
```bash
kubectl get all -n default
```

View File

@ -0,0 +1,54 @@
# K8S monitoring avec Prometheus et Openlens
## Installer Openlens (sur sa machine locale)
```bash
wget https://github.com/MuhammedKalkan/OpenLens/releases/download/v6.5.2-366/OpenLens-6.5.2-366.amd64.deb \
&& sudo apt install OpenLens*.deb
```
## Configurer le cluster pour etre accessible
- Editer le fichier `/etc/rancher/k3s/config.yaml`
```yml
tls-san:
- 78.192.247.57
write-kubeconfig-mode: "0644"
```
- Exporter et modifier la config
```bash
sudo cat /etc/rancher/k3s/k3s.yaml > kubeconfig.yml # fichier kubeconfig.yml à récupérer sur sa machine local
nano kubeconfig.yml
```
> Mettre l'IP publique du seveur:
```yml
server: https://<IP_PUBLIQUE>:6443
```
## Installation du monitoring
- Installer `helm`
```bash
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
```
- Installer `metrics-server`
```bash
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
```
- Deployer
```bash
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespace
```
- Visualiser dans `openlens` dans l'onglet configuration du cluster
```bash
# <namespace>/<service>:<port>
monitoring/prometheus-kube-prometheus-prometheus:9090
```

View File

@ -0,0 +1,5 @@
# Installer k3s sur des raspberry pi
<a href="https://git.legaragenumerique.fr/GARAGENUM/ansible-garage-kluster"><img src="https://duckduckgo.com/i/2826276fb92cb010.png" style="width: 300px; text-align: center;"></a>
[regarder ici](https://git.legaragenumerique.fr/GARAGENUM/ansible-garage-kluster)

View File

@ -159,6 +159,7 @@ nav:
- divers/devops/odoo/devenv.md - divers/devops/odoo/devenv.md
- divers/devops/odoo/devmodule.md - divers/devops/odoo/devmodule.md
- "CICD du garage": divers/devops/cicd.md - "CICD du garage": divers/devops/cicd.md
- "Kubernetes": divers/devops/k8s/index.md
- "Les guides Internes": - "Les guides Internes":
- "Imprimantes": divers/internal/install-printers.md - "Imprimantes": divers/internal/install-printers.md
- "Workadventure map": divers/internal/wa.md - "Workadventure map": divers/internal/wa.md