Skip to main content

Création d'un cluster K8S sur proxmox

Création de 3 VMS en désactivant le SWAP

  1. $ free -h.
  2. $ sudo swapoff -a.
  3. $ sudo nano /etc/fstab.
  4. # /dev/sda3 none swap sw 0 0.
  5. $ sudo swapoff -a.

Installation des outils

  1. Update the apt package index and install packages needed to use the Kubernetes apt repository:


    sudo apt-get update
    sudo apt-get install -y apt-transport-https ca-certificates curl gpg

  2. Download the public signing key for the Kubernetes package repositories. The same signing key is used for all repositories so you can disregard the version in the URL:

    curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
  1. Add the appropriate Kubernetes apt repository. If you want to use Kubernetes version different than v1.29, replace v1.29 with the desired minor version in the command below:

    echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
  1. Update apt package index, then install kubectl:

    sudo apt-get update
    sudo apt-get install -y docker.io kubelet kubeadm kubectl kubernetes-cni
containerd config default | sudo tee /etc/containerd/config.toml >/dev/null 2>&1

Edit the file ‘/etc/containerd/config.toml’ and look for the section ‘[plugins.”io.containerd.grpc.v1.cri”.containerd.runtimes.runc.options]’ and change ‘SystemdCgroup = false’ to ‘SystemdCgroup = true‘

$ sudo vi /etc/containerd/config.toml

Enable-SystemCgroup-Containerd-Debain12

Save and exit the file.

 

reboot

Initialisation du kube

Sur le noeud 1

kubeadm init

To start interacting with cluster, run following commands on master node,

$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

Run following kubectl command to get nodes and cluster information,

$ kubectl get nodes
$ kubectl cluster-info

Output of above commands

Ajout de nodes dans le kube