From e03c73c3358741ea1e31b4746aee367ca6497996 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 24 Jun 2021 13:06:42 +0200 Subject: [PATCH 1/3] Do not mount /etc/hosts under the same path --- .../roles/kubernetes_master/files/coredns-configmap.yml | 5 ++++- .../kubernetes_master/files/coredns-deployment-patch.yml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-configmap.yml b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-configmap.yml index fb3cbde0d6..fa25cfd30d 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-configmap.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-configmap.yml @@ -1,6 +1,9 @@ # Based on https://github.com/kubernetes/kubernetes/blob/v1.18.6/cluster/addons/dns/coredns/coredns.yaml.in # Hosts plugin added +# Note: /etc/hosts in pods is managed by kubelet thus we mount it under different path, +# see https://kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/#why-does-kubelet-manage-the-hosts-file + apiVersion: v1 kind: ConfigMap metadata: @@ -16,7 +19,7 @@ data: lameduck 5s } ready - hosts { + hosts /etc/hosts-mounted { fallthrough } kubernetes cluster.local in-addr.arpa ip6.arpa { diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-deployment-patch.yml b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-deployment-patch.yml index e1bc817f25..0b45a7c05b 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-deployment-patch.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/files/coredns-deployment-patch.yml @@ -8,7 +8,7 @@ spec: ephemeral-storage: 2Mi volumeMounts: - name: hosts-volume - mountPath: /etc/hosts + mountPath: /etc/hosts-mounted readOnly: true volumes: - name: hosts-volume From 33ff58a3532a9008d46dfd155f089ab3abfb1c3a Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 24 Jun 2021 13:07:41 +0200 Subject: [PATCH 2/3] Restart CoreDNS pods --- .../playbooks/roles/kubernetes_master/tasks/master-init.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/tasks/master-init.yml b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/tasks/master-init.yml index 77f1199ea7..c34eec21eb 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/tasks/master-init.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/kubernetes_master/tasks/master-init.yml @@ -70,5 +70,9 @@ - name: Patch CoreDNS include_tasks: patch-coredns.yml +# TODO: Restart conditionally (only when /etc/hosts was updated) or check whether newer CoreDNS would solve issue #2345 +- name: Restart CoreDNS pods + command: kubectl rollout restart deployment coredns --namespace kube-system + - name: Apply Kubernetes Dashboard include_tasks: apply-dashboard.yml From b249e0c120442a1e9c0b9bf55d2f39faeba51ca2 Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Thu, 24 Jun 2021 13:09:45 +0200 Subject: [PATCH 3/3] Update changelog --- CHANGELOG-1.1.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG-1.1.md b/CHANGELOG-1.1.md index 13a94db42a..ff60060298 100644 --- a/CHANGELOG-1.1.md +++ b/CHANGELOG-1.1.md @@ -38,6 +38,7 @@ - [#2332](https://github.com/epiphany-platform/epiphany/issues/2332) - [Elasticsearch] Error when having multiple VMs and non-clustered mode - [#1576](https://github.com/epiphany-platform/epiphany/issues/1576) - [Kafka] Incorrect number of brokers/queues available after scaling up/down - [#2381](https://github.com/epiphany-platform/epiphany/issues/2381) - Kibana fails to upgrade from epicli v1.0 to v1.1 (version comparison issue) +- [#2345](https://github.com/epiphany-platform/epiphany/issues/2345) - CoreDNS requires restart after scaling up nodes to be able to resolve new hostnames ### Updated