2018-03-13 11:00:05 +00:00
|
|
|
---
|
2021-02-09 14:02:40 +00:00
|
|
|
- name: Kubernetes Apps | Register coredns deployment annotation `createdby`
|
2022-01-05 10:26:32 +00:00
|
|
|
command: "{{ kubectl }} get deploy -n kube-system coredns -o jsonpath='{ .spec.template.metadata.annotations.createdby }'"
|
2021-02-09 14:02:40 +00:00
|
|
|
register: createdby_annotation
|
|
|
|
changed_when: false
|
2021-07-12 07:00:47 +00:00
|
|
|
ignore_errors: true # noqa ignore-errors
|
2021-02-09 14:02:40 +00:00
|
|
|
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]
|