forked from TimeBye/kubeadm-ha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
90-init-cluster.yml
95 lines (86 loc) · 1.8 KB
/
90-init-cluster.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# 校验节点软件系统及硬件系统、安装必要基础组件、docker、kubeadm、kubelet、kubectl
- hosts:
- all
gather_facts: false
tasks:
- name: "设置代理服务器环境变量"
set_fact:
proxy_env:
http_proxy: "{{ http_proxy | default ('') }}"
HTTP_PROXY: "{{ http_proxy | default ('') }}"
https_proxy: "{{ https_proxy | default ('') }}"
HTTPS_PROXY: "{{ https_proxy | default ('') }}"
no_proxy: "{{ no_proxy | default ('') }}"
NO_PROXY: "{{ no_proxy | default ('') }}"
no_log: true
- hosts:
- all
roles:
- prepare/variables
- prepare/base
- prepare/container-engine
- prepare/kubernetes
environment: "{{ proxy_env }}"
# 进行 apiserver 负载均衡
- hosts:
- all
roles:
- prepare/variables
- load-balancer
- hosts:
- all
roles:
- prepare/variables
- chrony
# 安装 etcd,并分发etcd证书到master节点
- hosts:
- etcd
- new-etcd
- kube-master
- new-master
roles:
- prepare/variables
- etcd/certificates
- etcd/install
# 生成 kubernetes 所需证书证书
- hosts:
- kube-master
- new-master
- kube-worker
- new-worker
roles:
- prepare/variables
- kube-certificates
# 初始化master节点
- hosts:
- kube-master
- new-master
roles:
- prepare/variables
- kube-master
# 初始化worker节点
- hosts:
- kube-worker
- new-worker
roles:
- prepare/variables
- kube-worker
# 标记各节点角色
- hosts:
- kube-master
- kube-worker
- new-master
- new-worker
roles:
- prepare/variables
- post
# 安装基础插件
- hosts:
- kube-master[0]
roles:
- prepare/variables
- plugins/network-plugins
- plugins/ingress-controller
- plugins/metrics-server
- plugins/kubernetes-dashboard
- plugins/cert-manager