Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
DevOps
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CLEMENTE Damien
DevOps
Commits
9547aec3
Commit
9547aec3
authored
3 months ago
by
CLEMENTE Damien
Browse files
Options
Downloads
Patches
Plain Diff
install1
parent
f9fef535
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
kubernetes_installation
+127
-0
127 additions, 0 deletions
kubernetes_installation
with
127 additions
and
0 deletions
kubernetes_installation
0 → 100644
+
127
−
0
View file @
9547aec3
# Installation et Configuration d'un Cluster Kubernetes sous Debian 12
## 1. Prérequis
- **OS** : Debian 12
- **Réseau** : 192.168.10.0/24
- **Infrastructure** : 3 VMs (1 Master, 2 Workers)
| Nom | Rôle | Adresse IP |
|----------|--------|-----------------|
| kube01 | Master | 192.168.10.10 |
| worker1 | Worker | 192.168.10.11 |
| worker2 | Worker | 192.168.10.12 |
- Configuration de **/etc/hosts** sur chaque machine :
```bash
127.0.0.1 localhost
127.0.1.1 kube01
192.168.10.11 worker1
192.168.10.10 kube01
192.168.10.12 worker2
```
## 2. Installation de Docker
Sur **chaque machine**, exécutez :
```bash
curl https://get.docker.com | bash
```
## 3. Désactivation du Swap
```bash
swapoff -a
sed -i '/ swap / s/^/#/' /etc/fstab
```
Vérification :
```bash
free -h
```
## 4. Configuration Système pour Kubernetes
Sur **toutes les machines**, exécutez :
```bash
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfilter
cat <<EOF | tee /etc/sysctl.d/99-kubernetes-k8s.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sysctl --system
```
## 5. Installation de Containerd
```bash
apt -y install containerd
containerd config default | tee /etc/containerd/config.toml >/dev/null 2>&1
```
## 6. Installation de Kubernetes (Kubeadm, Kubelet, Kubectl)
```bash
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.30/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] http://pkgs.k8s.io/core:/stable:/v1.30/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
apt update
apt -y install kubeadm kubelet kubectl
ln -s /opt/cni/bin /usr/lib/cni
```
## 7. Initialisation du Cluster Kubernetes
Sur **le master (kube01)** :
```bash
kubeadm init --control-plane-endpoint=192.168.10.10 --pod-network-cidr=10.244.0.0/16
```
Post-initialisation :
```bash
mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
```
Si root :
```bash
export KUBECONFIG=/etc/kubernetes/admin.conf
```
## 8. Ajout des Workers
Sur **chaque worker** :
```bash
kubeadm join 192.168.10.10:6443 --token <TOKEN> \
--discovery-token-ca-cert-hash sha256:<HASH>
```
Vérification :
```bash
kubectl get nodes
```
## 9. Installation du réseau des Pods
```bash
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment