5

I have set up Docker for Windows and minikube. Example listed here for (k8s.gcr.io/echoserver:1.10) works just fine: https://kubernetes.io/docs/setup/learning-environment/minikube/.

However when I create simple .NET MVC app under c:\dev\helloworld and try to run in in Minikube I get status: CrashLoopBackOff

Environment: Windows 10 Enterprise

Please help. What do i need to set up to make this work? u

ShaneKm
  • 20,823
  • 43
  • 167
  • 296
  • Can you show us the app source code? Chances are you have an error in the app, or it terminates without ever attaching a TTY, per this article: https://www.krenger.ch/blog/crashloopbackoff-and-how-to-fix-it/ – Jonathan M Sep 03 '19 at 19:50
  • You may gain some insight by running it only in Docker without Kubernetes. Also, check the suggestions in the answers here: https://stackoverflow.com/questions/44702715/kubernetes-pod-fails-with-crashloopbackoff – Jonathan M Sep 03 '19 at 19:54

1 Answers1

14

If you target the Docker daemon running in the minikube VM when you run docker build instead of the Docker for Windows daemon running on the host, then the minikube Docker will have access to that image and subsequent kubectl run commands will work as desired. I'm not sure exactly which commands to run on Windows, but on a POSIX system like Macs or Linux you can run:

# make 'docker' commands use daemon in minikube
eval $(minikube docker-env)

# build image so that minikube Docker daemon has it
docker build -t hello-world:v1 .

# deploy to kubernetes
kubectl run hello-world --image=hello-world:v1 --port=8080

# unset DOCKER environment variables so it goes back to 
# targetting the usual Docker for Windows
eval $(minikube docker-env -u)

I don't know if eval is the right thing to run on Windows, but if you just run minikube docker-env it will likely give you some instructions, e.g. for me it gives:

$ minikube docker-env
export DOCKER_TLS_VERIFY="1"
export DOCKER_HOST="tcp://192.168.99.103:2376"
export DOCKER_CERT_PATH="/Users/amitgupta/.minikube/certs"
# Run this command to configure your shell:
# eval $(minikube docker-env)
Amit Kumar Gupta
  • 17,184
  • 7
  • 46
  • 64
  • 5
    yes. that worked. In Windows Power Shell you do: PS C:\minikube> minikube docker-env. after that you should see a list of images in minikube, including the newly build docker image. Also, in deployment file: imagePullPolicy: Never – ShaneKm Sep 03 '19 at 20:08