-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkubeedge_cloud.yaml
92 lines (92 loc) · 3.21 KB
/
kubeedge_cloud.yaml
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
---
- hosts: kubeedge_cloud
remote_user: root
tasks:
- name: delete kubeedge directory
file:
path: /etc/kubeedge/
state: absent
- name: clear kubeedge binary
file:
path: /root/kubeedge/
state: absent
- name: copy kubeedge binary
copy:
src: /root/ansible_kubeedge/kubeedge/
dest: /root/kubeedge/
owner: root
- name: turn off swap
command: swapoff -a
- name: kubeadm reset
expect:
command: kubeadm reset
responses:
"Are you sure you want to proceed?": "y"
register: result
# - debug: var=result
- name: kill cloudcore
command: killall cloudcore
ignore_errors: yes
- name: kill edgecore
command: killall edgecore
ignore_errors: yes
- name: kubeadm init
command: kubeadm init --image-repository registry.cn-hangzhou.aliyuncs.com/google_containers --pod-network-cidr 10.244.0.0/16
- name: remove .kube directory
file:
path: /root/.kube/
state: absent
- name: create .kube directory
file:
path: /root/.kube/
state: directory
- name: copy .kube file
command: cp /etc/kubernetes/admin.conf /root/.kube/config
# copy: src=/etc/kubernetes/admin.conf dest=/root/.kube/config
# copy:
# src: /etc/kubernetes/admin.conf
# dest: /root/.kube/config
- name: fetch .kube file
fetch:
src: /root/.kube/config
dest: /root/ansible_kubeedge/.kube/config
flat: yes
- name: remove daemonset kube-proxy
command: kubectl delete daemonset -n kube-system kube-proxy
ignore_errors: True
- name: remove deploy kube-dns
command: kubectl delete deploy -n kube-system coredns
ignore_errors: True
- name: remove endpoint kube-dns
command: kubectl delete endpoint -n kube-system kube-dns
ignore_errors: True
- name: create kubeedge directory
file:
path: /etc/kubeedge/config/
state: directory
- name: chmod +x cloudcore binary
file:
path: /root/kubeedge/cloud/cloudcore/cloudcore
mode: 0755
- name: create cloudcore.yaml
shell: /root/kubeedge/cloud/cloudcore/cloudcore --defaultconfig > /etc/kubeedge/config/cloudcore.yaml
- name: copy device and objectsync yaml
copy:
src: /root/ansible_kubeedge/kubeedge_yaml/
dest: /root/kubeedge_yaml/
- name: create kubeedge device
command: kubectl apply -f /root/kubeedge_yaml/devices_v1alpha2_device.yaml
- name: create kubeedge devicemodel
command: kubectl apply -f /root/kubeedge_yaml/devices_v1alpha2_devicemodel.yaml
- name: create kubeedge cluster_objectsync
command: kubectl apply -f /root/kubeedge_yaml/cluster_objectsync_v1alpha1.yaml
- name: create kubeedge objectsync
command: kubectl apply -f /root/kubeedge_yaml/objectsync_v1alpha1.yaml
- name: copy cloudcore.service
copy:
src: /root/ansible_kubeedge/cloudcore.service
dest: /etc/systemd/system/cloudcore.service
- name: enable cloudcore.service
command: systemctl enable cloudcore.service
- name: restart cloudcore.service
command: systemctl restart cloudcore.service