diff --git a/cmd/kubeadm/app/phases/addons/dns/dns.go b/cmd/kubeadm/app/phases/addons/dns/dns.go index bfff580821b..323dc03f3de 100644 --- a/cmd/kubeadm/app/phases/addons/dns/dns.go +++ b/cmd/kubeadm/app/phases/addons/dns/dns.go @@ -382,6 +382,7 @@ func isCoreDNSConfigMapMigrationRequired(corefile, currentInstalledCoreDNSVersio if currentInstalledCoreDNSVersion == "" { return isMigrationRequired, nil } + currentInstalledCoreDNSVersion = strings.TrimLeft(currentInstalledCoreDNSVersion, "v") deprecated, err := migration.Deprecated(currentInstalledCoreDNSVersion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile) if err != nil { return isMigrationRequired, errors.Wrap(err, "unable to get list of changes to the configuration.") diff --git a/cmd/kubeadm/app/phases/upgrade/preflight.go b/cmd/kubeadm/app/phases/upgrade/preflight.go index 21e758b816f..344e0e09e3d 100644 --- a/cmd/kubeadm/app/phases/upgrade/preflight.go +++ b/cmd/kubeadm/app/phases/upgrade/preflight.go @@ -90,6 +90,8 @@ func checkUnsupportedPlugins(client clientset.Interface) error { if err != nil { return err } + + currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v") unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, currentInstalledCoreDNSversion, corefile) if err != nil { return err @@ -117,6 +119,7 @@ func checkMigration(client clientset.Interface) error { return err } + currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v") _, err = migration.Migrate(currentInstalledCoreDNSversion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile, false) if err != nil { return errors.Wrap(err, "CoreDNS will not be upgraded")