kubernetes: kubeadm upgrade (v1.19+) does not retain coredns configmap

What happened: kubeadm upgrade apply -y v1.19.3 does not retaining coredns configmap

...
[dryrun] Would perform action GET on resource "configmaps" in API group "core/v1"
[dryrun] Resource name: "coredns"
[dryrun] Returning faked GET response:
	apiVersion: v1
	data:
	  Corefile: |
	    consul {
	        errors
	        forward . 10.106.96.16:8600 10.106.96.17:8600 10.106.96.18:8600
	        loadbalance
	        cache 5
	        reload
	    }
...
[dryrun] Would perform action CREATE on resource "configmaps" in API group "core/v1"
[dryrun] Attached object:
	apiVersion: v1
	data:
	  Corefile: |
	    .:53 {
	        errors
	        health {
	           lameduck 5s
	        }
	        ready
	        kubernetes cluster.local in-addr.arpa ip6.arpa {
	           pods insecure
	           fallthrough in-addr.arpa ip6.arpa
	           ttl 30
	        }
	        prometheus :9153
	        forward . /etc/resolv.conf {
	           max_concurrent 1000
	        }
	        cache 30
	        loop
	        reload
	        loadbalance
	    }
	kind: ConfigMap
	metadata:
	  creationTimestamp: null
	  name: coredns
	  namespace: kube-system
...

using v1.19.4 makes no difference

What you expected to happen:

kubeadm upgrade apply should follow documentation and retain coredns configmap

How to reproduce it (as minimally and precisely as possible): upgrading from v1.18.6 to v1.19.3

Anything else we need to know?: kubeadm upgrade apply -y v1.18.12 works like a charm

[dryrun] Resource name: "coredns"
[dryrun] Attached patch:
	{"spec":{"template":{"spec":{"volumes":[{"name": "config-volume", "configMap":{"name": "coredns", "items":[{"key": "Corefile-backup", "path": "Corefile-backup"}]}}]}}}}
W1124 12:32:32.521106   19721 dns.go:282] the CoreDNS Configuration was not migrated: unable to migrate CoreDNS ConfigMap: start version '1.7.0' not supported. The existing CoreDNS Corefile configuration has been retained.
[dryrun] Would perform action GET on resource "configmaps" in API group "core/v1"
...
[dryrun] Would perform action UPDATE on resource "configmaps" in API group "core/v1"
[dryrun] Attached object:
	apiVersion: v1
	data:
	  Corefile: |
	    consul {
	        errors
	        forward . 10.106.96.16:8600 10.106.96.17:8600 10.106.96.18:8600
	        loadbalance
	        cache 5
	        reload
	    }
...

Environment:

  • Kubernetes version (use kubectl version): v1.18.6
  • Cloud provider or hardware configuration:
  • OS (e.g: cat /etc/os-release): CentOS 7
  • Kernel (e.g. uname -a): 4.20.13-1.el7.elrepo.x86_64
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (17 by maintainers)

Most upvoted comments

After testing with the code, I find the issue in https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/phases/upgrade/preflight.go#L132-L134, I fixed it in #96860 .

A workaround for you is to create an empty kube-dns configmap. ———————————————————— edited (new comments here)

I find #96860 still fix a problem , when kube-dns configmap is using federations.

seems to be a regression ?