Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minikube got stuck when creating container

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.

like image 697
nybon Avatar asked Oct 07 '16 06:10

nybon


People also ask

How do I reset my minikube?

If you want to wipe out your local Minikube cluster and restart, it is very easy to do so. Issuing a command to delete and then start Minikube will wipe out the environment and reset it to a blank slate: minikube deleteDeleting local Kubernetes cluster...

Can you run minikube in a docker container?

Minikube is virtual machine, that runs docker and kubernetes inside. Minikube uses Docker Machine to manage the Kubernetes VM so it benefits from the driver plugin architecture that Docker Machine uses to provide a consistent way to manage various VM providers.

How much memory does minikube need?

Setup. This reserves 6 GB of RAM for Minikube and starts it up. If you're low on RAM and only intend to run the databases on Minikube, you can likely get away with a smaller number, like 2048. More detailed instructions for setting up Minikube can be found here if that doesn't work.


1 Answers

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.

like image 96
nybon Avatar answered Sep 20 '22 06:09

nybon