-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy path91-add-worker.yml
84 lines (71 loc) · 1.74 KB
/
91-add-worker.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
- hosts: new-worker
roles:
- prepare/repository
- prepare/base
- chrony
- hosts:
- kube-master
- kube-worker
- new-worker
roles:
- prepare/nameserver
- hosts: new-worker
roles:
- { role: prepare/docker, when: "container_runtime == 'docker'" }
- { role: prepare/containerd, when: "container_runtime == 'containerd'" }
- hosts: new-worker
roles:
- prepare/kubernetes
- hosts: new-worker
roles:
- load-balancer
- hosts:
- kube-master
- kube-worker
- new-worker
roles:
- prepare/kube-certificates
- hosts: new-worker
gather_facts: false
roles:
- kube-worker
- hosts:
- kube-master
- kube-worker
- new-worker
gather_facts: false
roles:
- plugins/network-plugins/network-prepare
- hosts: kube-master[0]
gather_facts: false
roles:
- plugins/network-plugins/network-deploy
- hosts: new-worker
gather_facts: false
roles:
- post
- hosts: new-worker
gather_facts: false
tasks:
- block:
- name: Get ClusterIP of kube-dns
shell: "{{ bin_dir }}/kubectl get svc -n kube-system | grep kube-dns | grep -v upstream | awk '{ print $3 }'"
register: kube_dns_clusterip
run_once: true
- name: Modify the kubelet config file
lineinfile:
path: "/var/lib/kubelet/config.yaml"
regexp: '- {{ kube_dns_clusterip.stdout }}'
line: "- {{ pillar_local_dns }}"
- name: Restart kubelet
service:
name: kubelet
state: restarted
when:
- kube_proxy_mode == "ipvs"
- enable_dns_cache == "enable"
- component_created_by == "cluster"
- hosts: kube-master[0]
gather_facts: false
roles:
- { role: plugins/gpu/gpu-operator, when: "container_runtime == 'docker' and enable_gpu == 'enable' and component_created_by == 'cluster'" }