-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s-uninstall.yml
85 lines (74 loc) · 1.84 KB
/
k8s-uninstall.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
- hosts: all
become: yes
debugger: on_failed
tasks:
- name: Reset Kubeadm
command: kubeadm reset -f
args:
removes: /etc/kubernetes/admin.conf
- name: Stop the kubelet service
service:
name: kubelet
state: stopped
enabled: false
ignore_errors: true
- name: Stop the docker service
service:
name: docker
state: stopped
enabled: false
ignore_errors: true
- name: Remove kubelet and cni files
shell: |
rm -rf /var/lib/cni/ & rm -rf /var/lib/kubelet/* & rm -rf /etc/cni/ & rm -rf /etc/kubernetes/* & rm -rf /var/lib/etcd & rm -rf ~/pod_network_setup.txt & rm -rf ~/node_joined.txt
- name: Remove network configd
shell: |
ip link delete cni0 & ip link delete flannel.1 & ip link delete docker0
ignore_errors: yes
- name: Prevent apt errors
shell: |
rm /etc/apt/sources.list.d/kubernetes*
ignore_errors: true
- name: Remove the kubernetes and docker installation
apt:
name:
- kubeadm
- kubectl
- kubelet
- kubernetes-cni
- docker
- docker-engine
- docker.io
- containerd
- runc
- docker-ce
- docker-ce-cli
state: absent
purge: yes
autoremove: yes
force: yes
ignore_errors: true
- name: Remove config
shell: |
rm -rf ~/.kube
- hosts: all
become: yes
debugger: on_failed
tasks:
- name: Remove the docker installation
apt:
name:
- docker
- docker-engine
- docker.io
- containerd
- runc
- docker-ce
- docker-ce-cli
state: absent
purge: yes
- hosts: all
become: yes
tasks:
- name: reboot ALL machines
reboot: