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

improve exit message when trying to pull Non-Existing Kubernetes Version #11627

Closed
medyagh opened this issue Jun 10, 2021 · 11 comments · Fixed by #13354
Closed

improve exit message when trying to pull Non-Existing Kubernetes Version #11627

medyagh opened this issue Jun 10, 2021 · 11 comments · Fixed by #13354
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Milestone

Comments

@medyagh
Copy link
Member

medyagh commented Jun 10, 2021

I made a mistake and put in the wrong k8s version, we should have a more beautiful looking error, and ideally do not even try to create container when a non-existing k8s version is specified

mk start --kubernetes-version=20.10.7
😄  minikube v1.21.0-beta.0 on Darwin 11.4
✨  Automatically selected the docker driver. Other choices: hyperkit, parallels, virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🔥  Creating docker container (CPUs=2, Memory=4000MB) ...\ E0610 16:43:42.794488   82266 cache.go:211] Error caching images:  cached images list: version too new: 20.10.7

🐳  Preparing Kubernetes v20.10.7 on Docker 20.10.7 ...

❌  Exiting due to K8S_INSTALL_FAILED: kubeadm images: version too new: 20.10.7

╭────────────────────────────────────────────────────────────────────╮
│                                                                    │
│    😿  If the above advice does not help, please let us know:      │
│    👉  https://github.com/kubernetes/minikube/issues/new/choose    │
│                                                                    │
│    Please attach the following file to the GitHub issue:           │
│    - /Users/medya/.minikube/logs/lastStart.txt                     │
│                                                                    │
╰────────────────────────────────────────────────────────────────────╯


@medyagh medyagh added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Jun 10, 2021
@JacekDuszenko
Copy link
Contributor

JacekDuszenko commented Jun 10, 2021

I'd like to try and implement this

@JacekDuszenko
Copy link
Contributor

/assign

@JacekDuszenko
Copy link
Contributor

Hey @medyagh, I've just raised a PR with a fix #11631. Please, take a look.

@JacekDuszenko
Copy link
Contributor

/assign @medyagh

@afbjorklund
Copy link
Collaborator

afbjorklund commented Jun 13, 2021

I think I just added some assertions to the backend, to avoid trying to run with strange numbers. So it needs to start with 1.
Whenever Kubernetes 2.0 comes out, this would have to be revisited. But it should allow a couple of future releases yet ?

        if v.Major > 1 {
                return nil, fmt.Errorf("version too new: %v", v)
        }
        if semver.MustParseRange("<1.12.0-alpha.0")(v) {
                return nil, fmt.Errorf("version too old: %v", v)
        }

Kubeadm will just make something up, and hope for the best:

$ kubeadm config images list --kubernetes-version=20.10.7
W0613 20:44:50.874013  628468 images.go:80] could not find officially supported version of etcd for Kubernetes v20.10.7, falling back to the nearest etcd version (3.2.24)
k8s.gcr.io/kube-apiserver:v20.10.7
k8s.gcr.io/kube-controller-manager:v20.10.7
k8s.gcr.io/kube-scheduler:v20.10.7
k8s.gcr.io/kube-proxy:v20.10.7
k8s.gcr.io/pause:3.4.1
k8s.gcr.io/etcd:3.2.24
k8s.gcr.io/coredns/coredns:v1.8.0

@afbjorklund
Copy link
Collaborator

The error message for old releases is slightly more friendly:

❗  Specified Kubernetes version 1.10.0 is less than the oldest supported version: v1.14.0
❗  You can force an unsupported Kubernetes version via the --force flag

❌  Exiting due to K8S_OLD_UNSUPPORTED: Kubernetes 1.10.0 is not supported by this release of minikube

The situation is not so good when trying a far future release:

✨  Automatically selected the docker driver. Other choices: kvm2, podman, virtualbox, ssh
👍  Starting control plane node minikube in cluster minikube
🚜  Pulling base image ...
🔥  Creating docker container (CPUs=2, Memory=7900MB) ...
❗  The image 'k8s.gcr.io/kube-scheduler:v1.25.0' was not found; unable to add it to cache.
❗  The image 'k8s.gcr.io/kube-apiserver:v1.25.0' was not found; unable to add it to cache.
❗  The image 'k8s.gcr.io/kube-controller-manager:v1.25.0' was not found; unable to add it to cache.
❗  The image 'k8s.gcr.io/kube-proxy:v1.25.0' was not found; unable to add it to cache.
🐳  Preparing Kubernetes v1.25.0 on Docker 20.10.7 ...
❌  Unable to load cached images: loading cached images: stat /home/anders/.minikube/cache/images/k8s.gcr.io/kube-scheduler_v1.25.0: no such file or directory

❌  Exiting due to K8S_INSTALL_FAILED: updating control plane: downloading binaries: downloading kubelet: download failed: https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubelet?checksum=file:https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubelet.sha256: getter: &{Ctx:context.Background Src:https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubelet?checksum=file:https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/linux/amd64/kubelet.sha256 Dst:/home/anders/.minikube/cache/linux/v1.25.0/kubelet.download Pwd: Mode:2 Umask:---------- Detectors:[0x315d138 0x315d138 0x315d138 0x315d138 0x315d138 0x315d138 0x315d138] Decompressors:map[bz2:0x315d138 gz:0x315d138 tar.bz2:0x315d138 tar.gz:0x315d138 tar.xz:0x315d138 tar.zst:0x315d138 tbz2:0x315d138 tgz:0x315d138 txz:0x315d138 tzst:0x315d138 xz:0x315d138 zip:0x315d138 zst:0x315d138] Getters:map[file:0xc000663d10 http:0xc000c38f20 https:0xc000c38f40] Dir:false ProgressListener:0x3120890 Options:[0x190e6a0]}: invalid checksum: Error downloading checksum file: bad response code: 404

@afbjorklund
Copy link
Collaborator

Might have to add a new constant for this, the newest version that is supported with some similar version skew ?

    DefaultKubernetesVersion = "v1.20.7"
    NewestKubernetesVersion = "v1.22.0-alpha.2"
    OldestKubernetesVersion = "v1.14.0"

If assuming the same 6 versions (v1.20.x -> v1.14.0), then it would be a warning with anything above v1.26.0 ?

But I just hardcoded >= v2.0.0 as "too new", for now.

Parsing available versions etc is a different feature ?

@JacekDuszenko
Copy link
Contributor

Thank you for your input @afbjorklund . As I've already implemented what @medyagh suggested (fetching and parsing available versions), let's see what he thinks and we'll go from there. Also, feel free to look at my updated PR if you want. Thanks!

@afbjorklund
Copy link
Collaborator

Hardcoding future versions was not great idea anyway. In theory, minikube should continue to work also with those ?

@afbjorklund
Copy link
Collaborator

PR improves the failure scenario:
❌ Exiting due to K8S_VERSION_NOT_FOUND: Specified Kubernetes version 1.25.0 was not found in Kubernetes releases

Just need to make it possible to run offline too, where needed.
❌ Exiting due to K8S_RELEASE_FETCH_FAILED: Failed fetching available Kubernetes releases from GitHub repository. Check your internet connection

@spowelljr spowelljr added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Jun 15, 2021
@spowelljr spowelljr added this to the 1.22.0 milestone Jun 15, 2021
@spowelljr spowelljr added the kind/improvement Categorizes issue or PR as related to improving upon a current feature. label Jun 15, 2021
@spowelljr spowelljr added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 25, 2021
@spowelljr spowelljr modified the milestones: 1.24.0, 1.25.0-candidate Nov 5, 2021
@nishipy
Copy link
Contributor

nishipy commented Jan 16, 2022

I created a PR (#13354) to add simple solution for this issue. Please take a look. Thank you!
/assign

@sharifelgamal sharifelgamal removed this from the 1.25.0 milestone Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to improving upon a current feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
6 participants