Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tolerate failed coredns svc errors on kubeadm init/upgrade #6244

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions roles/kubernetes/master/tasks/kubeadm-secondary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
register: kubeadm_join_control_plane
retries: 3
until: kubeadm_join_control_plane is succeeded
failed_when:
- kubeadm_join_control_plane.rc != 0
- '"field is immutable" not in kubeadm_join_control_plane.stderr'
- '"unable to create/update the DNS service" not in kubeadm_join_control_plane.stdaerr'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo stdaerr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattymo ping

when:
- inventory_hostname != groups['kube-master']|first
- kubeadm_already_run is not defined or not kubeadm_already_run.stat.exists
Expand Down
23 changes: 22 additions & 1 deletion roles/kubernetes/master/tasks/kubeadm-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
retries: 3
until: kubeadm_upgrade.rc == 0
when: inventory_hostname == groups['kube-master']|first
failed_when: kubeadm_upgrade.rc != 0 and "field is immutable" not in kubeadm_upgrade.stderr
failed_when:
- kubeadm_upgrade.rc != 0
- '"field is immutable" not in kubeadm_upgrade.stderr'
- '"unable to create/update the DNS service" not in kubeadm_upgrade.stderr'
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
notify: Master | restart kubelet
Expand All @@ -44,6 +47,8 @@
failed_when:
- kubeadm_upgrade.rc != 0
- '"field is immutable" not in kubeadm_upgrade.stderr'
- '"unable to create/update the DNS service" not in kubeadm_upgrade.stderr'
- kubeadm_upgrade.stdout_lines | length > 1
environment:
PATH: "{{ bin_dir }}:{{ ansible_env.PATH }}"
notify: Master | restart kubelet
Expand Down Expand Up @@ -72,3 +77,19 @@
- kubeadm_scale_down_coredns_enabled
- dns_mode not in ['coredns', 'coredns_dual']
changed_when: false

- name: kubeadm | Remove kube-dns service if kubeadm upgrade created it
command: >-
{{ bin_dir }}/kubectl
--kubeconfig /etc/kubernetes/admin.conf
-n kube-system
delete svc kube-dns
register: delete_svc_kube_dns
retries: 6
delay: 2
until: delete_svc_kube_dns is succeeded
run_once: yes
when:
- dns_mode not in ['coredns', 'coredns_dual']
failed_when: false
changed_when: false