Minikube got stuck when creating container

nybon picture nybon · Oct 7, 2016 · Viewed 11k times · Source

I recently got started to learn Kubernetes by using Minikube locally in my Mac. Previously, I was able to start a local Kubernetes cluster with Minikube 0.10.0, created a deployment and viewed Kubernetes dashboard.

Yesterday I tried to delete the cluster and re-did everything from scratch. However, I found I cannot get the assets deployed and cannot view the dashboard. From what I saw, everything seemed to get stuck during container creation.

After I ran minikube start, it reported

Starting local Kubernetes cluster...
Kubectl is now configured to use the cluster.

When I ran kubectl get pods --all-namespaces, it reported (pay attention to the STATUS column):

kubectl get pods --all-namespaces
NAMESPACE     NAME                          READY     STATUS              RESTARTS   AGE
kube-system   kube-addon-manager-minikube   0/1       ContainerCreating   0          51s

docker ps showed nothing:

docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

minikube status tells me the VM and cluster are running:

minikubeVM: Running
localkube: Running

If I tried to create a deployment and an autoscaler, I was told they were created successfully:

kubectl create -f configs
deployment "hello-minikube" created
horizontalpodautoscaler "hello-minikube-autoscaler" created

$ kubectl get pods --all-namespaces
NAMESPACE     NAME                             READY     STATUS              RESTARTS   AGE
default       hello-minikube-661011369-1pgey   0/1       ContainerCreating   0          1m
default       hello-minikube-661011369-91iyw   0/1       ContainerCreating   0          1m
kube-system   kube-addon-manager-minikube      0/1       ContainerCreating   0          21m

When exposing the service, it said:

$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed

$ kubectl get service
NAME             CLUSTER-IP   EXTERNAL-IP   PORT(S)    AGE
hello-minikube   10.0.0.32    <nodes>       8080/TCP   6s
kubernetes       10.0.0.1     <none>        443/TCP    22m

When I tried to access the service, I was told:

curl $(minikube service hello-minikube --url)
Waiting, endpoint for service is not ready yet...

docker ps still showed nothing. It looked to me everything got stuck when creating a container. I tried some other ways to work around this issue:

  1. Upgraded to minikube 0.11.0
  2. Use the xhyve driver instead of the Virtualbox driver
  3. Delete everything cached, like ~/.minikube, ~/.kube, and the cluster, and re-try

None of them worked for me.

Kubernetes is still new to me and I would like to know:

  1. How can I troubleshoot this kind of issue?
  2. What could be the cause of this issue?

Any help is appreciated. Thanks.

Answer

nybon picture nybon · Oct 19, 2016

It turned out to be a network problem in my case.

The pod status is "ContainerCreating", and I found during container creation, docker image will be pulled from gcr.io, which is inaccessible in China (blocked by GFW). Previous time it worked for me because I happened to connect to a VPN.