marcuse
marcuse

Reputation: 4009

Minikube start command gives Template parsing error

I was playing around with Minikube and Docker Desktop and I used the minikube stop & minikube delete commands. After this I was unable to start minikube again resulting in the following error:

* minikube v1.11.0 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
* Using the docker driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing docker container for "minikube" ...
! StartHost failed, but will try again: provision: get ssh host-port: get port 22 for "minikube": docker container inspect -f "'{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}'" minikube: exit status 1
stdout:


stderr:
Template parsing error: template: :1:4: executing "" at <index (index .NetworkSettings.Ports "22/tcp") 0>: error calling index: index of untyped nil

* Restarting existing docker container for "minikube" ...
* Failed to start docker container. "minikube start" may fix it: driver start: expected container state be running but got "Stopped"
*
X error provisioning host: Failed to start host: driver start: expected container state be running but got "Stopped"
*
* 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

I tried starting Minikube again with both minikube start and minikube start --driver=docker. It resulted in the same error. So I tried to remove the Minikube docker image, but Docker wasn't working out anymore as well, it gave me the following error with every docker command:

An error occurred trying to connect: Get http://127.0.0.1:2375/v1.40/containers/json: dial tcp 127.0.0.1:2375: connectex: No connection could be made because the target machine actively refused it.

What to do?

Upvotes: 2

Views: 1956

Answers (1)

marcuse
marcuse

Reputation: 4009

I stumbled upon this answer which solved the Docker related error , open Git Bash and execute:

KUBECONFIG=~/.kube/config

This will tell Minikube to look at that folder for the configuration. Note that this environment variable is an extention of the $HOME environment variable. Check if this variable is correctly pointing towards %USERPROFILE%, check in Git Bash via echo $HOME.

After these both variables are set correctly my docker commands were working again.

Then I ran the following commands as advised here to start the minikube cluster again without any problems:

  1. docker system prune
  2. minikube delete
  3. minikube start --driver=docker

Upvotes: 2

Related Questions