-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Renew cert on start if current cert has has expired #10122
Comments
Also ran into this issue earlier today. However, it persists with the same error even if I downgrade
Same |
@dabcoder - Thanks |
Still unsure what caused this issue:
Looks certificate related, in any case I'd suggest renaming this issue to mention the error(s) from the |
this seems to be related to an expired cert, I wonder if you had this cluster for a long time ? in that case minikube should still have detected expired certs (or maybe we could provide more relaxed expiration for our certs) I would accept any PR that would increase our certs expiration to 5 years |
In my case, I've had it for a while yes, >= 18 months I would say.
@medyagh would the modification need to be done in https://github.com/kubernetes/minikube/blob/master/pkg/minikube/bootstrapper/certs.go? |
Although I am seeing this expiration date set to 10 years in the future: Line 51 in f0c59ce
|
Quick ping @medyagh, to see if you've had a chance to look at the above. |
@dabcoder - seems good to me! |
@sathyaprakashmani I suggest minikube at least print the Current Date and Time and The Expiry Time of cert if this error happens |
interestingly
and removing NotBefore and NotAfter code will not change anything
|
@medyagh I've not noticed any date/time issues on my machine, very unlikely to be the case there.
That would be good yes. |
There'a a workaround for those who want to keep the cluster data. |
I ran into this issue today, deleting /var/lib/minikube/certs did not help. Is there any other workaround, please? |
What is your error message then ? |
stderr: |
Can you
All files listed should have yesterday or today's date |
Some files in that folder have new date, and some have older date. I moved certs folder to certs_BC so that certs folder was recreated, so am not sure how its possible that some older files reappear here. |
docker@minikube:/var/lib/minikube/certs$ ll As can be seen here, some certificates are still old after recreating certs folder. |
Yeah, long running certs are a known issue in minikube. This is something we would like to fix, either with longer expiration, or proper certification rotation. |
Deleting the whole certs folder did not help. I restored it and then deleted the problematic certs iteratively, and in the end got it working, but all deployments were lost, so might have as well deleted minikube.
This results in:
Note that
These certs correspond to
And replaced the contents of But, as I noted above, the cluster got reset at some point, so I had to redeploy everything, which is a big problem for using minikube for anything other than a quick-dev/test and then throw it away. We need to be able to set it up, configure and leave it working for years without having to worry about it resetting once certificates expire. |
in my case deleting |
Donno how, minikube delete command resolved the issue |
i have a few questions on this:
NOTE: the ~.minikube folder has not been removed/altered.
|
I delete files and folders in the "/var/lib/minikube/certs/*" and minikube stop then start fix my issue |
kubeadm certs renew all -cert-dir /var/lib/minikube/certs |
@sharifelgamal can we reopen this issue? I dont think this is fixed. Or at least not as I would expect it to be fixed. Ive linked the issue from my repo here. You can check my latest comment on that issue which describes why I think its broken (and how to replicate it). Unless im doing something wrong, I think this issue still persists. Basically, if you use
and the problematic (not renewed) ones are
minikube version
Or is a new issue preferred? |
worked for me as well |
Slightly more surgical version of "delete all files and folders in /var/lib/minikube/certs" that worked for me in the case where I could not even start the cluster:
This deletes all the certs and keys that were last modified 2 or more days ago. |
I experienced this issue, and using a combination of the above seems to have recreated ALL of the certs with renewed expiration datetimes. On my windows machine under C:\Users<name>.minikube there are two certs folders, one at C:\Users<name>.minikube\certs and the other at C:\Users<name>.minikube\profiles\minikube To recreate the first set: (Powershell syntax) Stop current minikube clusterminikube stop Move main certs out of that pathmv C:\Users<name>.minikube\certs C:\Users<name>\Desktop Start a new cluster under a different profileminikube start -p xxx Allow above to create a new VM on a different profile. Main certs were recreated.Stop and delete the unneeded profileminikube stop -p xxx Move the original minikube profile certs out of that pathmv C:\Users<name>.minikube\profile\minikube C:\Users<name>\Desktop Start the original clusterminikube start -p minikube Now do the steps above posters mentioned get into the VM and move the folder at /var/lib/minikube/certs out of the wayminikube ssh Now stop and restart the clusterminikube stop endThis procedure seemed to renew all of the certs. However, a lot of these steps were guess work. Please comment if you feel something is wrong or don't work for you. |
I was able to restart my cluster with the following: minikube ssh
PATH="/var/lib/minikube/binaries/v1.25.2:$PATH"
kubeadm certs renew all --cert-dir /var/lib/minikube/certs
exit
minikube start |
After updating the certificates, all of my deployments were lost: root@minikube:/home/docker# PATH="/var/lib/minikube/binaries/v1.26.3:$PATH" root@minikube:/home/docker# kubeadm certs renew all --cert-dir /var/lib/minikube/certs Is it possible to recover my deployments somehow? |
Yes I faced the same issue all my deployment gone is there is any solution for that? I delete all all the certificates in the below path Then stop minikube and start again on the same profile |
Steps to reproduce the issue:
Oracle vm virtualbox version 6.1
kubectl version
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-19T07:38:38Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"darwin/amd64"}
minikube version
minikube version: v1.16.0
commit: 9f1e482
$ docker --version
Docker version 20.10.2, build 2291f61
minikube start
😄 minikube v1.16.0 on Darwin 10.15.7
🆕 Kubernetes 1.20.0 is now available. If you would like to upgrade, specify: --kubernetes-version=v1.20.0
✨ Using the virtualbox driver based on existing profile
👍 Starting control plane node minikube in cluster minikube
🏃 Updating the running virtualbox "minikube" VM ...
🐳 Preparing Kubernetes v1.17.0 on Docker 19.03.5 ...| E0110 11:59:25.743916 9686 kubeadm.go:647] sudo env PATH=/var/lib/minikube/binaries/v1.17.0:$PATH kubeadm init phase certs all --config /var/tmp/minikube/kubeadm.yaml failed - will try once more: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.17.0:$PATH kubeadm init phase certs all --config /var/tmp/minikube/kubeadm.yaml": Process exited with status 1
stdout:
[certs] Using certificateDir folder "/var/lib/minikube/certs"
[certs] Using existing ca certificate authority
[certs] Using existing apiserver certificate and key on disk
stderr:
W0110 16:59:25.557503 17370 validation.go:28] Cannot validate kube-proxy config - no validator is available
W0110 16:59:25.557541 17370 validation.go:28] Cannot validate kubelet config - no validator is available
error execution phase certs/apiserver-kubelet-client: failed to write or validate certificate "apiserver-kubelet-client": failure loading apiserver-kubelet-client certificate: failed to load certificate: the certificate has expired
To see the stack trace of this error execute with --v=5 or higher
/ 🤦 Unable to restart cluster, will reset it: run: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.17.0:$PATH kubeadm init phase certs all --config /var/tmp/minikube/kubeadm.yaml": Process exited with status 1
stdout:
[certs] Using certificateDir folder "/var/lib/minikube/certs"
[certs] Using existing ca certificate authority
[certs] Using existing apiserver certificate and key on disk
stderr:
W0110 16:59:25.744187 17376 validation.go:28] Cannot validate kube-proxy config - no validator is available
W0110 16:59:25.744235 17376 validation.go:28] Cannot validate kubelet config - no validator is available
error execution phase certs/apiserver-kubelet-client: failed to write or validate certificate "apiserver-kubelet-client": failure loading apiserver-kubelet-client certificate: failed to load certificate: the certificate has expired
To see the stack trace of this error execute with --v=5 or higher
stdout:
[init] Using Kubernetes version: v1.17.0
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[certs] Using certificateDir folder "/var/lib/minikube/certs"
[certs] Using existing ca certificate authority
[certs] Using existing apiserver certificate and key on disk
stderr:
💣 Error starting cluster: wait: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.17.0:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,DirAvailable--var-lib-minikube-etcd,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap": Process exited with status 1
stdout:
[init] Using Kubernetes version: v1.17.0
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[certs] Using certificateDir folder "/var/lib/minikube/certs"
[certs] Using existing ca certificate authority
[certs] Using existing apiserver certificate and key on disk
stderr:
😿 minikube is exiting due to an error. If the above message is not useful, open an issue:
👉 https://github.com/kubernetes/minikube/issues/new/choose
❌ Exiting due to GUEST_START: wait: /bin/bash -c "sudo env PATH=/var/lib/minikube/binaries/v1.17.0:$PATH kubeadm init --config /var/tmp/minikube/kubeadm.yaml --ignore-preflight-errors=DirAvailable--etc-kubernetes-manifests,DirAvailable--var-lib-minikube,DirAvailable--var-lib-minikube-etcd,FileAvailable--etc-kubernetes-manifests-kube-scheduler.yaml,FileAvailable--etc-kubernetes-manifests-kube-apiserver.yaml,FileAvailable--etc-kubernetes-manifests-kube-controller-manager.yaml,FileAvailable--etc-kubernetes-manifests-etcd.yaml,Port-10250,Swap": Process exited with status 1
stdout:
[init] Using Kubernetes version: v1.17.0
[preflight] Running pre-flight checks
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[certs] Using certificateDir folder "/var/lib/minikube/certs"
[certs] Using existing ca certificate authority
[certs] Using existing apiserver certificate and key on disk
stderr:
😿 If the above advice does not help, please let us know:
👉 https://github.com/kubernetes/minikube/issues/new/choose
Optional: Full output of
minikube logs
command:The text was updated successfully, but these errors were encountered: