En vue de préparer mes tests sur ArgoCD.
3 VM sous Debian 12 :
- worker: 8 go de ram, 4 cpu, 32 go de dd
- Nodes: 4 go de ram, 2 cpu, 32 go de dd
K3S
Requirement: iptables, curl
root@kube-master:~# curl -sfL https://get.k3s.io | sh -
[INFO] Finding release for channel stable
[INFO] Using v1.32.5+k3s1 as release
[INFO] Downloading hash https://github.com/k3s-io/k3s/releases/download/v1.32.5+k3s1/sha256sum-amd64.txt
[INFO] Downloading binary https://github.com/k3s-io/k3s/releases/download/v1.32.5+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] Host iptables-save/iptables-restore tools not found
[INFO] Host ip6tables-save/ip6tables-restore tools not found
[INFO] systemd: Starting k3s
Ici il trouve pas iptables-restore : normal c’est deprecated (faut-il installer iptables ??)
Maintenant il faut installer les workers k3s
root@kube-worker2:~# curl -sfL https://get.k3s.io | K3S_URL=https://<IP MASTER>:6443 K3S_TOKEN=<TOKEN> sh -
Ici il faut renseigner l’ip de la achine principal + le token qui se situe dans /var/lib/rancher/k3s/server/node-token
On installe helm , grosso modo c’est ici
Un peu d’UI
OpenLens étant plus maintenus depuis plus de deux ans, je me tourne vers Monokle. Il faut récupérer la config Kube. Sur le serveur exécuter:
kubectl config view --minify=true --raw=true
Mettre le contenu dans son PC et enregistrer le fichier config
dans ~/.kube/
Attention: si le fichier contient une ip type 127.0.0.1
il faut remplacer par l’ip du serveur
Tests de helm
Au moment d’installer Apache pour tester j’ai cette erreur
root@kube-master:~# helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories
root@kube-master:~# helm install apache bitnami/apache --set service.type=NodePort
Error: INSTALLATION FAILED: Kubernetes cluster unreachable: Get "http://localhost:8080/version": dial tcp [::1]:8080: connect: connection refused
Ici il faut exporter le KUBECONFIG
dans notre Shell
echo 'export KUBECONFIG=/etc/rancher/k3s/k3s.yaml' >> ~/.bashrc
source ~/.bashrc
Et refaire l’install apache, il sera accessible via le port qui sera attribué aléatoirement Pour voir l’ip + le port en faisant cette commande
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services apach
e)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].addres
s}")
echo http://$NODE_IP:$NODE_PORT/
Ce qui me donne pour moi 10.0.3.2:1234
Je laisse la section en dessous pour le moment, a voir si je le déplace.
ARGO CD
Suivre la doc pour l’install
Il faut exposer le port ARGO et récupérer son port
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
Pour le port
kubectl get svc -n argocd
Connexion
- https://ip machine:port
- User: admin
- Mot de passe:
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d