How to fix minikube install failure for minikube version 0.33.1 on Windows 10? - error restarting cluster - failure loading apiserver certificate

2/2/2019

I am attempting to install kubernetes on my local Windows 10 machine via hyperv. I am getting a few errors of which I am unsure how to resolve. I've tried running kubernetes v1.8.0 as well but received the same errors.

Here's what I input into powershell:

minikube start --kubernetes-version="v1.10.11" --vm-driver="hyperv" --hyperv-virtual-switch="Minikube"

Here's what was returned:

Getting VM IP address... Moving files into cluster... Stopping extra container runtimes... Machine exists, restarting cluster components... E0201 20:22:12.487856 13792 start.go:382] Error restarting cluster: running cmd: sudo kubeadm alpha phase certs all --config /var/lib/kubeadm.yaml: command failed: sudo kubeadm alpha phase certs all --config /var/lib/kubeadm.yaml stdout: [certificates] Using the existing ca certificate and key.

stderr: failure loading apiserver certificate: the certificate is not valid yet : Process exited with status 1 minikube failed :( exiting with error code 1

-- user11003796
certificate-error
kubernetes
minikube

1 Answer

2/4/2019

It might happen due to your old minikube cache. What I can advise you, is to delete your minikube installation along with minikube cache, and start from the scratch.

1) delete minikube minikube delete

2) clean up cache or .minikube folders:

cd C:\Users\user_name\.minikube\
Remove-Item –path C:\Users\user_name\.minikube\cache\* -recurse

The above will clean up the existing cache of your minikube. For me after the test is was:

    Directory: C:\Users\User\.minikube\cache


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----     Mon 04.02.19   1:55 PM                iso
d-----     Mon 04.02.19   2:25 PM                v1.10.11
d-----     Mon 04.02.19   2:40 PM                v1.8.0

Or alternatively you can try to remove all .minikube folder.

Remove-Item –path C:\Users\user_name\.minikube\* -recurse -force

3) start minikube. For me it started to work after above manipulations.

PS C:\Windows\system32> minikube start --kubernetes-version="v1.10.11" --vm-driver="hyperv" --hyperv-virtual-switch="Minikube"
Starting local Kubernetes v1.10.11 cluster...
Starting VM...
Downloading Minikube ISO
 181.48 MB / 181.48 MB [============================================] 100.00% 0s
Getting VM IP address...
Moving files into cluster...
Downloading kubeadm v1.10.11
Downloading kubelet v1.10.11
Finished Downloading kubeadm v1.10.11
Finished Downloading kubelet v1.10.11
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Stopping extra container runtimes...
Starting cluster components...
Verifying kubelet health ...
Verifying apiserver health ...
Kubectl is now configured to use the cluster.
Loading cached images from config file.


Everything looks great. Please enjoy minikube!
-- VKR
Source: StackOverflow