I get error message “runtime error: index out of range [0] with length 0” when I try to start minikube

别等时光非礼了梦想. 提交于 2021-01-29 18:56:58

问题


Maybe this a newbie question, I am installing minikube. When I try to start minikube (minikube start --vm-driver hyperv --hyperv-virtual-switch "MiniKube" --alsologtostderr -v=8 --memory=2000) I see an error message in the log (panic: runtime error: index out of range [0] with length 0):

I0410 07:24:15.123609    1724 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique
I0410 07:24:15.339794    1724 main.go:110] libmachine: [stdout =====>] :
I0410 07:24:15.339794    1724 main.go:110] libmachine: [stderr =====>] :
I0410 07:24:15.340756    1724 client.go:172] LocalClient.Create took 586.3704ms
panic: runtime error: index out of range [0] with length 0

This is the complete log:

PS C:\> minikube start --vm-driver hyperv --hyperv-virtual-switch "MiniKube" --alsologtostderr -v=8 --memory=2000
W0410 01:15:52.776702      72 root.go:248] Error reading config file at C:\Users\Cesar\.minikube\config\config.json: open C:\Users\Cesar\.minikube\config\config.json: The system cannot find the path specified.
I0410 01:15:52.780691      72 notify.go:125] Checking for updates...
I0410 01:15:53.293167      72 start.go:262] hostinfo: {"hostname":"DESKTOP-TVHSQJC","uptime":1563,"bootTime":1586497790,"procs":191,"os":"windows","platform":"Microsoft Windows 10 Home Single Language","platformFamily":"Standalone Workstation","platformVersion":"10.0.18362 Build 18362","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"33e72451-872e-4673-b23d-c29f75f4dc35"}
W0410 01:15:53.293167      72 start.go:270] gopshost.Virtualization returned error: not implemented yet
* minikube v1.9.2 en Microsoft Windows 10 Home Single Language 10.0.18362 Build 18362
I0410 01:15:53.362980      72 driver.go:245] Setting default libvirt URI to qemu:///system
* Using the hyperv driver based on user configuration
I0410 01:15:54.783789      72 start.go:310] selected driver: hyperv
I0410 01:15:54.784786      72 start.go:656] validating driver "hyperv" against <nil>
I0410 01:15:54.788061      72 start.go:662] status for hyperv: {Installed:true Healthy:true Error:<nil> Fix: Doc:}
I0410 01:15:54.788775      72 start.go:1210] Wait components to verify : map[apiserver:true system_pods:true]
I0410 01:15:54.789771      72 iso.go:119] acquiring lock: {Name:mk489b460911118cd1582e81f0bed446f9566f30 Clock:{} Delay:500ms Timeout:10m0s Cancel:<nil>}
* Downloading VM boot image ...
I0410 01:15:54.814975      72 iso.go:147] full url: https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso?checksum=file:https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso.sha256
    > minikube-v1.9.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.9.0.iso: 174.93 MiB / 174.93 MiB [ 100.00% 1.82 MiB p/s 1m36s
* Starting control plane node m01 in cluster minikube
I0410 01:17:33.260532      72 preload.go:81] Checking if preload exists for k8s version v1.18.0 and runtime docker
I0410 01:17:33.538319      72 preload.go:114] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4
I0410 01:17:33.538319      72 cache.go:46] Caching tarball of preloaded images
I0410 01:17:33.542306      72 preload.go:81] Checking if preload exists for k8s version v1.18.0 and runtime docker
I0410 01:17:33.643204      72 preload.go:114] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4
* Downloading Kubernetes v1.18.0 preload ...
I0410 01:17:33.669080      72 preload.go:144] Downloading: &{Ctx:<nil> Src:https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4 Dst:C:\Users\Cesar\.minikube\cache\preloaded-tarball\preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4.download Pwd: Mode:2 Detectors:[] Decompressors:map[] Getters:map[] Dir:false ProgressListener:<nil> Options:[0xc15670]}
    > preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4: 542.91 MiB
I0410 01:22:35.483647      72 preload.go:160] saving checksum for preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4 ...
I0410 01:22:35.794173      72 preload.go:177] verifying checksumm of C:\Users\Cesar\.minikube\cache\preloaded-tarball\preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4.download ...
I0410 01:22:37.049807      72 cache.go:49] Finished downloading the preloaded tar for v1.18.0 on docker
I0410 01:22:37.050808      72 profile.go:138] Saving config to C:\Users\Cesar\.minikube\profiles\minikube\config.json ...
I0410 01:22:37.051804      72 lock.go:35] WriteFile acquiring C:\Users\Cesar\.minikube\profiles\minikube\config.json: {Name:mk135836da876aa669fb2d39bc4acd571651f245 Clock:{} Delay:500ms Timeout:1m0s Cancel:<nil>}
I0410 01:22:37.061190      72 cache.go:117] Successfully downloaded all kic artifacts
I0410 01:22:37.061190      72 start.go:260] acquiring machines lock for minikube: {Name:mk72c8971e0e6c4ad7d34035b9e15502a51a2ea9 Clock:{} Delay:500ms Timeout:15m0s Cancel:<nil>}
I0410 01:22:37.062189      72 start.go:264] acquired machines lock for "minikube" in 0s
I0410 01:22:37.065183      72 start.go:86] Provisioning new machine with config: {Name:minikube KeepContext:false EmbedCerts:false MinikubeISO:https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso Memory:2000 CPUs:2 DiskSize:20000 Driver:hyperv HyperkitVpnKitSock: HyperkitVSockPorts:[] DockerEnv:[] InsecureRegistry:[] RegistryMirror:[] HostOnlyCIDR:192.168.99.1/24 HypervVirtualSwitch:MiniKube HypervUseExternalSwitch:false HypervExternalAdapter: KVMNetwork:default KVMQemuURI:qemu:///system KVMGPU:false KVMHidden:false DockerOpt:[] DisableDriverMounts:false NFSShare:[] NFSSharesRoot:/nfsshares UUID: NoVTXCheck:false DNSProxy:false HostDNSResolver:true HostOnlyNicType:virtio NatNicType:virtio KubernetesConfig:{KubernetesVersion:v1.18.0 ClusterName:minikube APIServerName:minikubeCA APIServerNames:[] APIServerIPs:[] DNSDomain:cluster.local ContainerRuntime:docker CRISocket: NetworkPlugin: FeatureGates: ServiceCIDR:10.96.0.0/12 ImageRepository: ExtraOptions:[] ShouldLoadCachedImages:true EnableDefaultCNI:false NodeIP: NodePort:0 NodeName:} Nodes:[{Name:m01 IP: Port:8443 KubernetesVersion:v1.18.0 ControlPlane:true Worker:true}] Addons:map[] VerifyComponents:map[apiserver:true system_pods:true]} {Name:m01 IP: Port:8443 KubernetesVersion:v1.18.0 ControlPlane:true Worker:true}
I0410 01:22:37.065183      72 start.go:107] createHost starting for "m01" (driver="hyperv")
* Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
I0410 01:22:37.131796      72 start.go:143] libmachine.API.Create for "minikube" (driver="hyperv")
I0410 01:22:37.132794      72 client.go:169] LocalClient.Create starting
I0410 01:22:37.136784      72 main.go:110] libmachine: Creating CA: C:\Users\Cesar\.minikube\certs\ca.pem
I0410 01:22:37.277444      72 main.go:110] libmachine: Creating client certificate: C:\Users\Cesar\.minikube\certs\cert.pem
I0410 01:22:37.618494      72 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique
I0410 01:22:37.838183      72 main.go:110] libmachine: [stdout =====>] :
I0410 01:22:37.838183      72 main.go:110] libmachine: [stderr =====>] :
I0410 01:22:37.839147      72 client.go:172] LocalClient.Create took 703.289ms
panic: runtime error: index out of range [0] with length 0

goroutine 162 [running]:
github.com/docker/machine/drivers/hyperv.hypervAvailable(0xc0003b4630, 0xc00021f3f0)
        /go/pkg/mod/github.com/machine-drivers/machine@v0.7.1-0.20200323212942-41eb826190d8/drivers/hyperv/powershell.go:64 +0x105
github.com/docker/machine/drivers/hyperv.(*Driver).PreCreateCheck(0xc0005d4ba0, 0x0, 0x0)
        /go/pkg/mod/github.com/machine-drivers/machine@v0.7.1-0.20200323212942-41eb826190d8/drivers/hyperv/hyperv.go:171 +0x3b
k8s.io/minikube/pkg/minikube/machine.(*LocalClient).Create(0xc000216340, 0xc0005d4c00, 0x0, 0x0)
        /app/pkg/minikube/machine/client.go:229 +0x3f5
k8s.io/minikube/pkg/minikube/machine.timedCreateHost.func2(0x1e08b00, 0xc000216340, 0xc0005d4c00, 0xc0002771d0, 0xc0005300e0)
        /app/pkg/minikube/machine/start.go:170 +0x42
created by k8s.io/minikube/pkg/minikube/machine.timedCreateHost
        /app/pkg/minikube/machine/start.go:169 +0x10e
PS C:\> minikube delete
! "minikube" profile does not exist, trying anyways.
* Removed all traces of the "minikube" cluster.
PS C:\> minikube start --vm-driver hyperv --hyperv-virtual-switch "MiniKube" --alsologtostderr -v=8 --memory=2000
I0410 07:17:24.557312    1724 notify.go:125] Checking for updates...
I0410 07:17:25.094876    1724 start.go:262] hostinfo: {"hostname":"DESKTOP-TVHSQJC","uptime":23254,"bootTime":1586497791,"procs":216,"os":"windows","platform":"Microsoft Windows 10 Home Single Language","platformFamily":"Standalone Workstation","platformVersion":"10.0.18362 Build 18362","kernelVersion":"","virtualizationSystem":"","virtualizationRole":"","hostid":"33e72451-872e-4673-b23d-c29f75f4dc35"}
W0410 07:17:25.094876    1724 start.go:270] gopshost.Virtualization returned error: not implemented yet
* minikube v1.9.2 en Microsoft Windows 10 Home Single Language 10.0.18362 Build 18362
I0410 07:17:25.200591    1724 driver.go:245] Setting default libvirt URI to qemu:///system
* Using the hyperv driver based on user configuration
I0410 07:17:26.923910    1724 start.go:310] selected driver: hyperv
I0410 07:17:26.923910    1724 start.go:656] validating driver "hyperv" against <nil>
I0410 07:17:26.923910    1724 start.go:662] status for hyperv: {Installed:true Healthy:true Error:<nil> Fix: Doc:}
I0410 07:17:26.924950    1724 start.go:1210] Wait components to verify : map[apiserver:true system_pods:true]
I0410 07:17:26.924950    1724 iso.go:119] acquiring lock: {Name:mk489b460911118cd1582e81f0bed446f9566f30 Clock:{} Delay:500ms Timeout:10m0s Cancel:<nil>}
* Downloading VM boot image ...
I0410 07:17:26.959728    1724 iso.go:147] full url: https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso?checksum=file:https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso.sha256
    > minikube-v1.9.0.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s
    > minikube-v1.9.0.iso: 174.93 MiB / 174.93 MiB [ 100.00% 1.80 MiB p/s 1m37s
* Starting control plane node m01 in cluster minikube
I0410 07:19:06.392837    1724 preload.go:81] Checking if preload exists for k8s version v1.18.0 and runtime docker
I0410 07:19:06.811093    1724 preload.go:114] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4
I0410 07:19:06.812115    1724 cache.go:46] Caching tarball of preloaded images
I0410 07:19:06.818091    1724 preload.go:81] Checking if preload exists for k8s version v1.18.0 and runtime docker
I0410 07:19:06.938300    1724 preload.go:114] Found remote preload: https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4
* Downloading Kubernetes v1.18.0 preload ...
I0410 07:19:06.963740    1724 preload.go:144] Downloading: &{Ctx:<nil> Src:https://storage.googleapis.com/minikube-preloaded-volume-tarballs/preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4 Dst:C:\Users\Cesar\.minikube\cache\preloaded-tarball\preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4.download Pwd: Mode:2 Detectors:[] Decompressors:map[] Getters:map[] Dir:false ProgressListener:<nil> Options:[0xc15670]}
    > preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4: 542.91 MiB
I0410 07:24:12.620296    1724 preload.go:160] saving checksum for preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4 ...
I0410 07:24:13.151132    1724 preload.go:177] verifying checksumm of C:\Users\Cesar\.minikube\cache\preloaded-tarball\preloaded-images-k8s-v2-v1.18.0-docker-overlay2-amd64.tar.lz4.download ...
I0410 07:24:14.351294    1724 cache.go:49] Finished downloading the preloaded tar for v1.18.0 on docker
I0410 07:24:14.351294    1724 profile.go:138] Saving config to C:\Users\Cesar\.minikube\profiles\minikube\config.json ...
I0410 07:24:14.352249    1724 lock.go:35] WriteFile acquiring C:\Users\Cesar\.minikube\profiles\minikube\config.json: {Name:mk135836da876aa669fb2d39bc4acd571651f245 Clock:{} Delay:500ms Timeout:1m0s Cancel:<nil>}
I0410 07:24:14.634215    1724 cache.go:117] Successfully downloaded all kic artifacts
I0410 07:24:14.634215    1724 start.go:260] acquiring machines lock for minikube: {Name:mk72c8971e0e6c4ad7d34035b9e15502a51a2ea9 Clock:{} Delay:500ms Timeout:15m0s Cancel:<nil>}
I0410 07:24:14.635218    1724 start.go:264] acquired machines lock for "minikube" in 0s
I0410 07:24:14.639240    1724 start.go:86] Provisioning new machine with config: {Name:minikube KeepContext:false EmbedCerts:false MinikubeISO:https://storage.googleapis.com/minikube/iso/minikube-v1.9.0.iso Memory:2000 CPUs:2 DiskSize:20000 Driver:hyperv HyperkitVpnKitSock: HyperkitVSockPorts:[] DockerEnv:[] InsecureRegistry:[] RegistryMirror:[] HostOnlyCIDR:192.168.99.1/24 HypervVirtualSwitch:MiniKube HypervUseExternalSwitch:false HypervExternalAdapter: KVMNetwork:default KVMQemuURI:qemu:///system KVMGPU:false KVMHidden:false DockerOpt:[] DisableDriverMounts:false NFSShare:[] NFSSharesRoot:/nfsshares UUID: NoVTXCheck:false DNSProxy:false HostDNSResolver:true HostOnlyNicType:virtio NatNicType:virtio KubernetesConfig:{KubernetesVersion:v1.18.0 ClusterName:minikube APIServerName:minikubeCA APIServerNames:[] APIServerIPs:[] DNSDomain:cluster.local ContainerRuntime:docker CRISocket: NetworkPlugin: FeatureGates: ServiceCIDR:10.96.0.0/12 ImageRepository: ExtraOptions:[] ShouldLoadCachedImages:true EnableDefaultCNI:false NodeIP: NodePort:0 NodeName:} Nodes:[{Name:m01 IP: Port:8443 KubernetesVersion:v1.18.0 ControlPlane:true Worker:true}] Addons:map[] VerifyComponents:map[apiserver:true system_pods:true]} {Name:m01 IP: Port:8443 KubernetesVersion:v1.18.0 ControlPlane:true Worker:true}
I0410 07:24:14.639240    1724 start.go:107] createHost starting for "m01" (driver="hyperv")
* Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
I0410 07:24:14.750393    1724 start.go:143] libmachine.API.Create for "minikube" (driver="hyperv")
I0410 07:24:14.753426    1724 client.go:169] LocalClient.Create starting
I0410 07:24:14.755381    1724 main.go:110] libmachine: Creating CA: C:\Users\Cesar\.minikube\certs\ca.pem
I0410 07:24:14.928984    1724 main.go:110] libmachine: Creating client certificate: C:\Users\Cesar\.minikube\certs\cert.pem
I0410 07:24:15.123609    1724 main.go:110] libmachine: [executing ==>] : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -NonInteractive @(Get-Module -ListAvailable hyper-v).Name | Get-Unique
I0410 07:24:15.339794    1724 main.go:110] libmachine: [stdout =====>] :
I0410 07:24:15.339794    1724 main.go:110] libmachine: [stderr =====>] :
I0410 07:24:15.340756    1724 client.go:172] LocalClient.Create took 586.3704ms
panic: runtime error: index out of range [0] with length 0

goroutine 164 [running]:
github.com/docker/machine/drivers/hyperv.hypervAvailable(0xc0003ee8d0, 0xc000266a90)
        /go/pkg/mod/github.com/machine-drivers/machine@v0.7.1-0.20200323212942-41eb826190d8/drivers/hyperv/powershell.go:64 +0x105
github.com/docker/machine/drivers/hyperv.(*Driver).PreCreateCheck(0xc000592420, 0x0, 0x0)
        /go/pkg/mod/github.com/machine-drivers/machine@v0.7.1-0.20200323212942-41eb826190d8/drivers/hyperv/hyperv.go:171 +0x3b
k8s.io/minikube/pkg/minikube/machine.(*LocalClient).Create(0xc000218d80, 0xc000592480, 0x0, 0x0)
        /app/pkg/minikube/machine/client.go:229 +0x3f5
k8s.io/minikube/pkg/minikube/machine.timedCreateHost.func2(0x1e08b00, 0xc000218d80, 0xc000592480, 0xc000215100, 0xc00005e230)
        /app/pkg/minikube/machine/start.go:170 +0x42
created by k8s.io/minikube/pkg/minikube/machine.timedCreateHost
        /app/pkg/minikube/machine/start.go:169 +0x10e

I would like if starting process was executed successfully.

PD: I deactived firewall when execute the command.


回答1:


The issues you are encountering are strictly connected with this line:

minikube v1.9.2 en Microsoft Windows 10 Home Single Language 10.0.18362 Build 18362

Windows 10 Home does not support Hyper-V.

Citing official Microsoft page:

Enable Hyper-V to create virtual machines on Windows 10.
Hyper-V can be enabled in many ways including using the Windows 10 control panel, PowerShell or using the Deployment Imaging Servicing and Management tool (DISM). This documents walks through each option.

Note: Hyper-V is built into Windows as an optional feature -- there is no Hyper-V download.

Check Requirements

  • Windows 10 Enterprise, Pro, or Education
  • 64-bit Processor with Second Level Address Translation (SLAT).
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPUs).
  • Minimum of 4 GB memory.

-- Docs.microsoft.com: Virtualization: Enable hyper v

As you can see there is a requirement that forbids using Hyper-V with Windows 10 Home.

For your minikube to work you can either:

  • Use a different Hypervisor like for example Virtualbox and then start minikube start --vm-driver=virtualbox
  • Upgrade your Windows 10 to version that officially supports Hyper-V


来源:https://stackoverflow.com/questions/61140329/i-get-error-message-runtime-error-index-out-of-range-0-with-length-0-when-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!