How to migrate kubeconfig on windows 10

1/7/2020

I have been trying to install minikube for two days now. I have run into issue after issue. This one has me stumped.

  • install minikube on windows 10
  • Docker has been running with hyperv for months
  • followed windows using choco ignoring everything with hyperv install.

W0107 08:23:27.485052 3337 common.go:77] your configuration file uses a deprecated API spec: "kubeadm.k8s.io/v1beta1". Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.

From what i understand there is a new config. that i need to migrate to. to do that i need to use kubeadm but I haven't been able to find any information on where to find these files or how to do the migration. Here is what i have tried.

From an elevated command prompt i ran:

  • minikube ssh

Then i found kubeadm in the following directory.

  • cd /var/lib/minikube/binaries/v1.17.0

where by i started throwing some random commands at it in hopes of some help

$ ./kubeadm version
kubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:17:50Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}


$ ./kubeadm config view
failed to load admin kubeconfig: open /home/docker/.kube/config: no such file or directory
To see the stack trace of this error execute with --v=5 or higher

$ ./kubeadm init --config defaults
unable to read config from "defaults" : open defaults: no such file or directory
To see the stack trace of this error execute with --v=5 or higher

As the error message said to run this i gave that a go. That didnt work either

$ ./kubeadm config migrate --old-config old.yaml --new-config new.yaml
open old.yaml: no such file or directory
To see the stack trace of this error execute with --v=5 or higher

After digging around in the logs i found that it was trying to load the following config file so i tried to load that as the old one in hopes it was smart enough to make its own new one.

./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config new.yaml
open /var/tmp/minikube/kubeadm.yaml: permission denied 
To see the stack trace of this error execute with --v=5 or higher

Ok then lets check the permissions on the file

$ ls -la /var/tmp/minikube/kubeadm.yaml
-rw-r----- 1 root root 1156 Jan  1  0001 /var/tmp/minikube/kubeadm.yaml

Well that's not good let's try to update it

$ chmod u=r /var/tmp/minikube/kubeadm.yaml
chmod: changing permissions of '/var/tmp/minikube/kubeadm.yaml': Operation not 
 permitted

ok

$ sudu chmod u=r /var/tmp/minikube/kubeadm.yaml
-bash: sudu: command not found

edit sudo

 $ sudo chmod u=r /var/tmp/minikube/kubeadm.yaml 
 $ ls -la /var/tmp/minikube/kubeadm.yaml
 -r--r----- 1 root root 1156 Jan  1  0001 /var/tmp/minikube/kubeadm.yaml

update 777

$ sudo chmod 777 /var/tmp/minikube/kubeadm.yaml
$ ls -la /var/tmp/minikube/kubeadm.yaml
-rwxrwxrwx 1 root root 1156 Jan  1  0001 /var/tmp/minikube/kubeadm.yaml
fig new.yamlconfig migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-conf
W0107 13:19:23.298409    4361 validation.go:28] Cannot validate kube-proxy config - no validator is available
W0107 13:19:23.298437    4361 validation.go:28] Cannot validate kubelet config - no validator is available
failed to write the new configuration to the file "new.yaml": open new.yaml: permission denied
To see the stack trace of this error execute with --v=5 or higher

Still no dice. this appears to be a very limited bash shell.

have a file

Ok thanks to some chmod 777's i know have a file but what do i do with it?

./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config /home/docker/new.yaml
W0107 13:22:21.615314    6352 validation.go:28] Cannot validate kube-proxy config - no validator is available
W0107 13:22:21.615375    6352 validation.go:28] Cannot validate kubelet config - no validator is available

There seems to be little or no documentation on how to deal with this I have cross posted the issue on the forum. #6227 any help would be greatly appreciated. I have tried to remove minikube and add it again with the same results.

current status

sudo chmod 777 /var/tmp/minikube/kubeadm.yaml
ls -la /var/tmp/minikube/kubeadm.yaml
cd /var/lib/minikube/binaries/v1.17.0
./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config /home/docker/new.yaml
sudo chmod 777 /var/tmp/minikube 
mv /var/tmp/minikube/kubeadm.yaml /var/tmp/minikube/kubeadmold.yaml
mv /home/docker/new.yaml /var/tmp/minikube/kubeadm.yaml

minikube start --vm-driver=hyperv --v=7 --alsologtostderr

No change same error message.

1.16.0

C:\Windows\system32>minikube start --vm-driver=hyperv --kubernetes-version=1.16.0
* minikube v1.6.0 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
* Selecting 'hyperv' driver from user configuration (alternates: [])
* Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
X minikube is unable to connect to the VM: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address

This is likely due to one of two reasons:

- VPN or firewall interference
- hyperv network configuration issue

Suggested workarounds:

- Disable your local VPN or firewall software
- Configure your local VPN or firewall to allow access to fe80::215:5dff:fe37:c505
- Restart or reinstall hyperv
- Use an alternative --vm-driver
-- DaImTo
kubernetes
minikube
windows-10

1 Answer

1/14/2020

As you are able to see kubeadm version it suggest that you used Kubernetes kubeadm, which is bit different from Minikube.

Kubeadm is a tool to get Kubernetes working on existing machine. It will configure and start all required Kubernetes components. Using Kubeadm you are able to create cluster with multiple nodes (kubeadm join).

Minikube is a tool which start single Kubernets Cluster local node.

There is already good explanation in this Stackoverflow question.

I don't think that Kubeadm configuration from Linux will work on Windows. As you mentioned in comment, that you want to run Minikube in windows to learn Kubernetes, I will provide step by step how to run Minikube on Windows 10.

Installation Minikube on Windows 10

As you already have docker I will skip that installation steps.

1. Download kubectl and minikube.

Newest version is provided in official kubernetes docs.

kubectl v1.17 and minikube from github (minikube-windows-amd64.exe).

2. Add to PATH form folder to Environment Variables.

Create folder where you will paste kubectl.exe and renamed minikube.exe file. Add This folder to PATH. (If someone would need here is tutorial).

3. Create external Virtual Switch Manager in Hyper-V.

Go to Hyper-V. From the right menu choose Virtual Switch Manager. Choose External and name it Primary Virtual Switch. Then apply.

4. Verify minikube and kubeadm versions.

PS C:\WINDOWS\system32> kubectl version
Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"windows/amd64"}​
Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}​
PS C:\WINDOWS\system32> minikube version​
minikube version: v1.6.2commit: 54f28ac5d3a815d1196cd5d57d707439ee4bb392

5. Create Minikube Cluster.

Run PowerShell as Administrator.

minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"

PS C:\WINDOWS\system32> minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"
* minikube v1.6.2 on Microsoft Windows 10 Enterprise 10.0.17134 Build 17134​
* Selecting 'hyperv' driver from user configuration (alternates: [])​
* Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...​
* Preparing Kubernetes v1.17.0 on Docker '19.03.5' ...​
* Pulling images ...​
* Launching Kubernetes ...​
* Waiting for cluster to come online ...​
* Done! kubectl is now configured to use "minikube"

Now you can use kubectl commands and already have default resources required for running Minikube.

PS C:\WINDOWS\system32> kubectl get pods --all-namespaces​
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE​
kube-system   coredns-6955765f44-c4cbj           1/1     Running   0          31m​
kube-system   coredns-6955765f44-rqfth           1/1     Running   0          31m​
kube-system   etcd-minikube                      1/1     Running   0          31m​
kube-system   kube-addon-manager-minikube        1/1     Running   0          31m​
kube-system   kube-apiserver-minikube            1/1     Running   0          31m​
kube-system   kube-controller-manager-minikube   1/1     Running   0          31m​
kube-system   kube-proxy-j6q29                   1/1     Running   0          31m​
kube-system   kube-scheduler-minikube            1/1     Running   0          31m​
kube-system   storage-provisioner                1/1     Running   0          31m

In addition, you can check this article about running Minikube on windows.

Also you can consider Docker for Windows which will do many things automatically, however it will install older version of kubernetes (1.14 at the moment).

-- PjoterS
Source: StackOverflow