forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
24.restore.yml
76 lines (64 loc) · 1.43 KB
/
24.restore.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 集群从备份恢复的脚本,使用请参阅文档 docs/op/cluster_restore.md
# 在deploy节点恢复CA相关证书
- hosts: deploy
tasks:
- name: 恢复CA 文件夹
file: name=/etc/kubernetes/ssl/ state=directory
- name: 恢复CA 相关文件
copy:
src: "{{ base_dir }}/roles/cluster-backup/files/ca/{{ item }}"
dest: "{{ ca_dir }}/{{ item }}"
with_items:
- ca.pem
- ca-key.pem
- ca.csr
- ca-csr.json
- ca-config.json
- hosts: deploy
roles:
- deploy
# 集群节点的公共配置任务
- hosts: all
roles:
- prepare
# [可选]多master部署时的负载均衡配置
- hosts: lb
roles:
- lb
# 创建etcd集群
- hosts: etcd
roles:
- etcd
# docker服务安装
- hosts:
- kube-master
- kube-node
- new-master
- new-node
roles:
- docker
- hosts:
- kube-master
- new-master
roles:
- kube-master
- kube-node
# 禁止业务 pod调度到 master节点
tasks:
- name: 禁止业务 pod调度到 master节点
shell: "{{ bin_dir }}/kubectl cordon {{ inventory_hostname }} "
when: DEPLOY_MODE != "allinone"
ignore_errors: true
- name: 设置master节点role
shell: "{{ bin_dir }}/kubectl label node {{ inventory_hostname }} kubernetes.io/role=master --overwrite"
ignore_errors: true
# node 节点部署
- hosts:
- kube-node
- new-node
roles:
- kube-node
# etcd 集群进行数据恢复
- hosts: etcd
roles:
- cluster-restore