Restore from Gitea ZIP snapshot (12.08.2026) after full instance reinstall
Git history was lost when the previous Gitea instance was wiped and reinstalled due to an unresolved corruption bug — this commit is the last known-good file content, exported before the reinstall. Prior commit history is not recoverable through this path.
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
---
|
||||
- name: Подготовка всех узлов
|
||||
hosts: k8s_nodes
|
||||
become: true
|
||||
tasks:
|
||||
- name: 0. Ожидание разблокировки APT
|
||||
shell: "while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do sleep 5; done;"
|
||||
changed_when: false
|
||||
|
||||
- name: 1. Установка системных зависимостей
|
||||
apt:
|
||||
update_cache: yes
|
||||
name: [apt-transport-https, ca-certificates, curl, gnupg, qemu-guest-agent, socat, conntrack]
|
||||
state: present
|
||||
register: apt_res
|
||||
until: apt_res is success
|
||||
retries: 20
|
||||
delay: 10
|
||||
|
||||
- name: 2. Настройка модулей и sysctl
|
||||
shell: |
|
||||
modprobe overlay && modprobe br_netfilter
|
||||
echo -e "overlay\nbr_netfilter" > /etc/modules-load.d/k8s.conf
|
||||
cat <<EOF > /etc/sysctl.d/k8s.conf
|
||||
net.bridge.bridge-nf-call-iptables = 1
|
||||
net.bridge.bridge-nf-call-ip6tables = 1
|
||||
net.ipv4.ip_forward = 1
|
||||
EOF
|
||||
sysctl --system
|
||||
changed_when: false
|
||||
|
||||
- name: 3. Установка Containerd
|
||||
apt:
|
||||
name: containerd
|
||||
state: present
|
||||
|
||||
- name: 4. Конфигурация Containerd
|
||||
shell: |
|
||||
mkdir -p /etc/containerd
|
||||
containerd config default > /etc/containerd/config.toml
|
||||
sed -i 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
|
||||
systemctl restart containerd
|
||||
changed_when: true
|
||||
|
||||
- name: 5. Добавление репозитория Kubernetes (Tsinghua)
|
||||
shell: |
|
||||
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.32/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg --yes
|
||||
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg arch=amd64] https://mirrors.tuna.tsinghua.edu.cn/kubernetes/core:/stable:/v1.32/deb/ /" > /etc/apt/sources.list.d/kubernetes.list
|
||||
|
||||
- name: 6. Установка пакетов Kubernetes
|
||||
apt:
|
||||
name: [kubelet, kubeadm, kubectl]
|
||||
state: present
|
||||
update_cache: yes
|
||||
register: k8s_apt
|
||||
until: k8s_apt is success
|
||||
retries: 15
|
||||
delay: 10
|
||||
|
||||
- name: Инициализация Master
|
||||
hosts: masters_group
|
||||
become: true
|
||||
tasks:
|
||||
- name: Kubeadm Init
|
||||
shell: "kubeadm init --pod-network-cidr=10.244.0.0/16 --skip-phases=addon/kube-proxy"
|
||||
args:
|
||||
creates: /etc/kubernetes/admin.conf
|
||||
|
||||
- name: Config for ubuntu user
|
||||
shell: |
|
||||
mkdir -p /home/ubuntu/.kube
|
||||
cp -f /etc/kubernetes/admin.conf /home/ubuntu/.kube/config
|
||||
chown ubuntu:ubuntu /home/ubuntu/.kube/config
|
||||
|
||||
- name: Generate Join Command
|
||||
shell: "kubeadm token create --print-join-command"
|
||||
register: join_cmd
|
||||
|
||||
- name: Join Workers
|
||||
hosts: workers_group
|
||||
become: true
|
||||
tasks:
|
||||
- name: Join to cluster
|
||||
shell: "{{ hostvars['k8s-master']['join_cmd']['stdout'] }}"
|
||||
args:
|
||||
creates: /etc/kubernetes/kubelet.conf
|
||||
|
||||
- name: Установка Cilium CNI (Слой сети)
|
||||
hosts: masters_group
|
||||
become: true
|
||||
tasks:
|
||||
- name: Скачивание Cilium CLI
|
||||
get_url:
|
||||
url: https://github.com/cilium/cilium-cli/releases/latest/download/cilium-linux-amd64.tar.gz
|
||||
dest: /tmp/cilium.tar.gz
|
||||
register: cilium_dl
|
||||
until: cilium_dl is success
|
||||
retries: 5
|
||||
delay: 10
|
||||
|
||||
- name: Распаковка Cilium CLI
|
||||
shell: tar xzvf /tmp/cilium.tar.gz -C /usr/local/bin
|
||||
args:
|
||||
creates: /usr/local/bin/cilium
|
||||
|
||||
- name: Установка Cilium в кластер
|
||||
# Выполняем как пользователь ubuntu, чтобы иметь доступ к кубеконфигу
|
||||
become: true
|
||||
become_user: ubuntu
|
||||
shell: /usr/local/bin/cilium install --set kubeProxyReplacement=true
|
||||
ignore_errors: true
|
||||
Reference in New Issue
Block a user