root@kube-03:/home/guillaume# apt install -y curl ca-certificates
root@kube-01:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--cluster-init \
--node-name kube-01 \
--tls-san 192.168.50.11
Ici :
Cluster-init permet d'initialiser le cluster;--tls-san permet de démarrer l'API sans difficultés en précisant l'interface d'écoute.Attendre une bonne minute.
Résultat :
root@kube-01:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--cluster-init \
--node-name kube-01 \
--tls-san 192.168.50.11
[INFO] Finding release for channel stable
[INFO] Using v1.34.3+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
root@kube-01:/home/guillaume# kubectl get nodes
Résultat :
root@kube-01:/home/guillaume# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube-01 Ready control-plane,etcd 2m5s v1.34.3+k3s1
Le cluster est maintenant prêt.
root@kube-01:/home/guillaume# cat /var/lib/rancher/k3s/server/node-token
Résultat :
root@kube-01:/home/guillaume# cat /var/lib/rancher/k3s/server/node-token
K10783d5ce9eece1e02defb325e7b00546aa57b31cd9874650be3731df0feedf969::server:b70cc2e2ef986197966d927011268e66
root@kube-02:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--server https://192.168.50.11:6443 \
--token K10783d5ce9eece1e02defb325e7b00546aa57b31cd9874650be3731df0feedf969::server:b70cc2e2ef986197966d927011268e66 \
--node-name kube-02 \
--tls-san 192.168.50.12
root@kube-02:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--server https://192.168.50.11:6443 \
--token K10783d5ce9eece1e02defb325e7b00546aa57b31cd9874650be3731df0feedf969::server:b70cc2e2ef986197966d927011268e66 \
--node-name kube-02 \
--tls-san 192.168.50.12
[INFO] Finding release for channel stable
[INFO] Using v1.34.3+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
root@kube-03:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--server https://192.168.50.11:6443 \
--token K10783d5ce9eece1e02defb325e7b00546aa57b31cd9874650be3731df0feedf969::server:b70cc2e2ef986197966d927011268e66 \
--node-name kube-03 \
--tls-san 192.168.50.13
root@kube-03:/home/guillaume# curl -sfL https://get.k3s.io | sh -s - server \
--server https://192.168.50.11:6443 \
--token K10783d5ce9eece1e02defb325e7b00546aa57b31cd9874650be3731df0feedf969::server:b70cc2e2ef986197966d927011268e66 \
--node-name kube-03 \
--tls-san 192.168.50.13
[INFO] Finding release for channel stable
[INFO] Using v1.34.3+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.34.3+k3s1/k3s
[INFO] Verifying binary download
[INFO] Installing k3s to /usr/local/bin/k3s
[INFO] Skipping installation of SELinux RPM
[INFO] Creating /usr/local/bin/kubectl symlink to k3s
[INFO] Creating /usr/local/bin/crictl symlink to k3s
[INFO] Creating /usr/local/bin/ctr symlink to k3s
[INFO] Creating killall script /usr/local/bin/k3s-killall.sh
[INFO] Creating uninstall script /usr/local/bin/k3s-uninstall.sh
[INFO] env: Creating environment file /etc/systemd/system/k3s.service.env
[INFO] systemd: Creating service file /etc/systemd/system/k3s.service
[INFO] systemd: Enabling k3s unit
Created symlink /etc/systemd/system/multi-user.target.wants/k3s.service → /etc/systemd/system/k3s.service.
[INFO] systemd: Starting k3s
root@kube-01:/home/guillaume# kubectl get nodes
Ready:root@kube-01:/home/guillaume# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kube-01 Ready control-plane,etcd 9m31s v1.34.3+k3s1
kube-02 Ready control-plane,etcd 2m32s v1.34.3+k3s1
kube-03 Ready control-plane,etcd 54s v1.34.3+k3s1