feat: Configuration stockage local et token K3S partagé
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Successful in 2m12s
CD - Deploy Infrastructure / Deploy on pve2 (push) Successful in 2m11s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 2m28s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Successful in 5m3s
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Successful in 17s
CD - Deploy Infrastructure / Deploy on pve1 (push) Successful in 2m12s
CD - Deploy Infrastructure / Deploy on pve2 (push) Successful in 2m11s
CD - Deploy Infrastructure / Deploy on pve3 (push) Successful in 2m28s
CD - Deploy Infrastructure / Validate K3s Cluster (push) Successful in 5m3s
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s
- Passage stockage local-nvme pour acemagician et elitedesk (40G) - Token K3S partagé via cloud-init pour cluster HA - Configuration FluxCD avec GitRepository Forgejo - Déploiement Hello World via FluxCD - Manifestes Kubernetes pour application demo
This commit is contained in:
parent
a818aab4be
commit
3b5f1fc2d2
17 changed files with 193 additions and 84 deletions
|
|
@ -1,6 +1,4 @@
|
|||
---
|
||||
# K3s server installation and configuration
|
||||
|
||||
- name: Check if K3s is already installed
|
||||
stat:
|
||||
path: /usr/local/bin/k3s
|
||||
|
|
@ -17,10 +15,15 @@
|
|||
set_fact:
|
||||
is_first_server: "{{ ansible_default_ipv4.address == k3s_server_1_ip }}"
|
||||
|
||||
- name: Load K3s token from environment
|
||||
set_fact:
|
||||
k3s_token: "{{ lookup('env', 'K3S_TOKEN') }}"
|
||||
|
||||
- name: Install K3s on first server (cluster-init)
|
||||
shell: >
|
||||
curl -sfL {{ k3s_install_url }} |
|
||||
INSTALL_K3S_VERSION="{{ k3s_version }}"
|
||||
K3S_TOKEN="{{ k3s_token }}"
|
||||
sh -s - server
|
||||
--cluster-init
|
||||
--tls-san {{ k3s_server_1_ip }}
|
||||
|
|
@ -44,17 +47,13 @@
|
|||
timeout: 300
|
||||
when: is_first_server
|
||||
|
||||
- name: Get K3s token from first server
|
||||
slurp:
|
||||
src: /var/lib/rancher/k3s/server/node-token
|
||||
register: k3s_token_encoded
|
||||
when: is_first_server
|
||||
run_once: true
|
||||
|
||||
- name: Save K3s token
|
||||
set_fact:
|
||||
k3s_token: "{{ k3s_token_encoded.content | b64decode | trim }}"
|
||||
when: is_first_server
|
||||
- name: Wait for first server API (second server)
|
||||
wait_for:
|
||||
host: "{{ k3s_server_1_ip }}"
|
||||
port: 6443
|
||||
delay: 30
|
||||
timeout: 600
|
||||
when: not is_first_server
|
||||
|
||||
- name: Install K3s on second server (join cluster)
|
||||
shell: >
|
||||
|
|
@ -62,7 +61,7 @@
|
|||
INSTALL_K3S_VERSION="{{ k3s_version }}"
|
||||
sh -s - server
|
||||
--server https://{{ k3s_server_1_ip }}:6443
|
||||
--token {{ k3s_token | default('PLACEHOLDER') }}
|
||||
--token {{ k3s_token }}
|
||||
--tls-san {{ k3s_server_2_ip }}
|
||||
--write-kubeconfig-mode 644
|
||||
--disable traefik
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue