Cannot use Kubernetes on Windows

51 Views Asked by At

I am using Docker for some time, recently I enabled Kubernetes and installed minikube and kubectl. For some reason I am not able to run the command minikube start --driver=docker. Here you can see the log containing the error:

PS C:\Users\____> minikube start --driver=docker --alsologtostderr -v=1
I0209 17:35:09.246083    3088 out.go:296] Setting OutFile to fd 84 ...
I0209 17:35:09.247170    3088 out.go:309] Setting ErrFile to fd 88...
I0209 17:35:09.917371    3088 out.go:303] Setting JSON to false
I0209 17:35:09.922261    3088 start.go:128] hostinfo: {"hostname":"PL1ROBAV0056NB","uptime":12412,"bootTime":1707480497,"procs":371,"os":"windows","platform":"Microsoft Windows 10 Enterprise","platformFamily":"Standalone Workstation","platformVersion":"10.0.19045.3930 Build 19045.3930","kernelVersion":"10.0.19045.3930 Build 19045.3930","kernelArch":"x86_64","virtualizationSystem":"","virtualizationRole":"","hostId":"42989683-f0db-4357-8e3d-6b4f1bb46318"}
W0209 17:35:09.922261    3088 start.go:136] gopshost.Virtualization returned error: not implemented yet
I0209 17:35:09.923390    3088 out.go:177]   minikube v1.32.0 on Microsoft Windows 10 Enterprise 10.0.19045.3930 Build 19045.3930
  minikube v1.32.0 on Microsoft Windows 10 Enterprise 10.0.19045.3930 Build 19045.3930
I0209 17:35:09.924996    3088 notify.go:220] Checking for updates...
W0209 17:35:09.924996    3088 preload.go:295] Failed to list preload files: open C:\Users\____\.minikube\cache\preloaded-tarball: The system cannot find the file specified.
I0209 17:35:09.925544    3088 driver.go:378] Setting default libvirt URI to qemu:///system
W0209 17:36:06.944876    3088 docker.go:169] docker version returned error: deadline exceeded running "docker version --format {{.Server.Os}}-{{.Server.Version}}:{{.Server.Platform.Name}}": context deadline exceeded
I0209 17:36:06.946159    3088 out.go:177] ✨  Using the docker driver based on user configuration
✨  Using the docker driver based on user configuration
I0209 17:36:06.947266    3088 start.go:298] selected driver: docker
I0209 17:36:06.947266    3088 start.go:902] validating driver "docker" against <nil>
I0209 17:36:06.947266    3088 start.go:913] status for docker: {Installed:true Healthy:false Running:false NeedsImprovement:false Error:context deadline exceeded
deadline exceeded running "docker version --format {{.Server.Os}}-{{.Server.Version}}:{{.Server.Platform.Name}}"
k8s.io/minikube/pkg/minikube/registry/drvs/docker.glob..func1
        /app/pkg/minikube/registry/drvs/docker/docker.go:165
k8s.io/minikube/pkg/minikube/registry/drvs/docker.status
        /app/pkg/minikube/registry/drvs/docker/docker.go:98
k8s.io/minikube/pkg/minikube/registry.Status
        /app/pkg/minikube/registry/global.go:145
k8s.io/minikube/pkg/minikube/driver.Status
        /app/pkg/minikube/driver/driver.go:361
k8s.io/minikube/cmd/minikube/cmd.selectDriver
        /app/cmd/minikube/cmd/start.go:709
k8s.io/minikube/cmd/minikube/cmd.runStart
        /app/cmd/minikube/cmd/start.go:207
github.com/spf13/cobra.(*Command).execute
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
        /go/pkg/mod/github.com/spf13/[email protected]/command.go:992
k8s.io/minikube/cmd/minikube/cmd.Execute
        /app/cmd/minikube/cmd/root.go:174
main.main
        /app/cmd/minikube/main.go:95
runtime.main
        /usr/local/go/src/runtime/proc.go:267
runtime.goexit
        /usr/local/go/src/runtime/asm_amd64.s:1650 Reason:PROVIDER_DOCKER_DEADLINE_EXCEEDED Fix:Restart the Docker service Doc:https://minikube.sigs.k8s.io/docs/drivers/docker/ Version:}
I0209 17:36:06.948961    3088 out.go:177]

W0209 17:36:06.950214    3088 out.go:239]   Exiting due to PROVIDER_DOCKER_NOT_RUNNING: deadline exceeded running "docker version --format <no value>-<no value>:<no value>": context deadline exceeded
  Exiting due to PROVIDER_DOCKER_NOT_RUNNING: deadline exceeded running "docker version --format <no value>-<no value>:<no value>": context deadline exceeded
W0209 17:36:06.950214    3088 out.go:239]   Suggestion: Restart the Docker service
  Suggestion: Restart the Docker service
W0209 17:36:06.950751    3088 out.go:239]   Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/
  Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/
I0209 17:36:06.951873    3088 out.go:177]

I have seen a very similar question, and the answer there was to use an older version of Docker, I also tried using Docker 24.0.7, but it didn't work. Below you can see the versions for all the applications involved in this:

PS C:\Users\____> docker version
Client:
 Cloud integration: v1.0.35+desktop.10
 Version:           25.0.2
 API version:       1.44
 Go version:        go1.21.6
 Git commit:        29cf629
 Built:             Thu Feb  1 00:24:09 2024
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.27.1 (136059)
 Engine:
  Version:          25.0.2
  API version:      1.44 (minimum version 1.24)
  Go version:       go1.21.6
  Git commit:       fce6e0c
  Built:            Thu Feb  1 00:23:17 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
PS C:\Users\____> docker version --format "{{.Server.Os}}-{{.Server.Version}}:{{.Server.Platform.Name}}"
linux-25.0.2:Docker Desktop 4.27.1 (136059)
PS C:\Users\____> minikube version
minikube version: v1.32.0
commit: 8220a6eb95f0a4d75f7f2d7b14cef975f050512d
PS C:\Users\____> kubectl version
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.1 
1

There are 1 best solutions below

1
Muravyev Maxim On

This regularly happens to me on Windows, the solution is opinionated, but you can try sequentially:

  1. minikube config set driver docker
  2. minikube delete or better to remove it completely
  3. docker system prune -a --volumes
  4. minikube start --driver=docker