2018-03-13 11:00:05 +00:00
|
|
|
---
|
2021-02-09 14:02:40 +00:00
|
|
|
- name: Kubernetes Apps | Register coredns deployment annotation `createdby`
|
|
|
|
shell: "{{ bin_dir }}/kubectl get deploy -n kube-system coredns -o jsonpath='{ .spec.template.metadata.annotations.createdby }'"
|
|
|
|
register: createdby_annotation
|
|
|
|
changed_when: false
|
|
|
|
ignore_errors: true
|
|
|
|
when:
|
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2021-02-09 14:02:40 +00:00
|
|
|
|
2018-03-13 11:00:05 +00:00
|
|
|
- name: Kubernetes Apps | Delete kubeadm CoreDNS
|
|
|
|
kube:
|
|
|
|
name: "coredns"
|
2018-03-30 11:29:13 +00:00
|
|
|
namespace: "kube-system"
|
2018-03-13 11:00:05 +00:00
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "deploy"
|
|
|
|
state: absent
|
|
|
|
when:
|
2019-05-07 20:20:36 +00:00
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|
2021-02-09 14:02:40 +00:00
|
|
|
- createdby_annotation.stdout != 'kubespray'
|
2019-05-07 20:20:36 +00:00
|
|
|
|
|
|
|
- name: Kubernetes Apps | Delete kubeadm Kube-DNS service
|
|
|
|
kube:
|
|
|
|
name: "kube-dns"
|
|
|
|
namespace: "kube-system"
|
|
|
|
kubectl: "{{ bin_dir }}/kubectl"
|
|
|
|
resource: "svc"
|
|
|
|
state: absent
|
|
|
|
when:
|
|
|
|
- dns_mode in ['coredns', 'coredns_dual']
|
2021-03-24 00:26:05 +00:00
|
|
|
- inventory_hostname == groups['kube_control_plane'][0]
|