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
26 lines
704 B
Bash
26 lines
704 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
if systemctl is-active --quiet k3s; then
|
|
NODE_NAME=$(hostname)
|
|
|
|
echo "$(date): Starting pre-reboot drain for node $NODE_NAME" | logger -t k3s-pre-reboot
|
|
|
|
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
|
|
|
|
/usr/local/bin/k3s kubectl drain "$NODE_NAME" \
|
|
--ignore-daemonsets \
|
|
--delete-emptydir-data \
|
|
--force \
|
|
--timeout=300s 2>&1 | logger -t k3s-pre-reboot
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "$(date): Node $NODE_NAME drained successfully" | logger -t k3s-pre-reboot
|
|
else
|
|
echo "$(date): Warning - Node drain failed or timed out" | logger -t k3s-pre-reboot
|
|
fi
|
|
else
|
|
echo "$(date): k3s service not active, skipping drain" | logger -t k3s-pre-reboot
|
|
fi
|
|
|
|
exit 0
|