Service never runs

1/30/2018

I am using minikube on Linux to get started with kubernetes. Going with the examples in the readme and going with the none vm-diver, I do the following.

$ minikube start --vm-driver=none
Starting local Kubernetes v1.9.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
===================
WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS
    The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks

When using the none driver, the kubectl config and credentials generated will be root owned and will appear in the root home directory.
You will need to move the files to the appropriate location and then set the correct permissions.  An example of this is below:

    sudo mv /root/.kube $HOME/.kube # this will write over any previous configuration
    sudo chown -R $USER $HOME/.kube
    sudo chgrp -R $USER $HOME/.kube

    sudo mv /root/.minikube $HOME/.minikube # this will write over any previous configuration
    sudo chown -R $USER $HOME/.minikube
    sudo chgrp -R $USER $HOME/.minikube

This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
Loading cached images from config file.

$ kubectl get nodes
No resources found.

$ kubectl run hello-minikube --image=k8s.gcr.io/echoserver:1.4 --port=8080
deployment "hello-minikube" created
$ kubectl expose deployment hello-minikube --type=NodePort
service "hello-minikube" exposed

$ kubectl get pod
NAME                            READY     STATUS    RESTARTS   AGE
hello-minikube-c6c6764d-h64t8   0/1       Pending   0          3m

Now, the problem is that this pod continues to remain pending. It looks like there are no nodes to run it on but I do not know why. Where am I going wrong?

EDIT: Here is the output of describeing the pod.

$ kubectl describe pod hello-minikube-c6c6764d-h64t8
Name:           hello-minikube-c6c6764d-h64t8
Namespace:      default
Node:           <none>
Labels:         pod-template-hash=72723208
                run=hello-minikube
Annotations:    <none>
Status:         Pending
IP:
Controlled By:  ReplicaSet/hello-minikube-c6c6764d
Containers:
  hello-minikube:
    Image:        k8s.gcr.io/echoserver:1.4
    Port:         8080/TCP
    Environment:  <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-dw4j7 (ro)
Conditions:
  Type           Status
  PodScheduled   False
Volumes:
  default-token-dw4j7:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-dw4j7
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     <none>
Events:
  Type     Reason            Age                From               Message
  ----     ------            ----               ----               -------
  Warning  FailedScheduling  20h (x4 over 20h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  20h (x4 over 20h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  20h (x5 over 20h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  19h (x5 over 19h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  19h (x5 over 19h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  18h (x5 over 18h)  default-scheduler  no nodes available to schedule pods
  Warning  FailedScheduling  1s (x5 over 16s)   default-scheduler  no nodes available to schedule pods
-- r.v
kubernetes
minikube

1 Answer

8/25/2019

try running minikube status if you get this then try running this command. fix worked for me: sudo chown -R $USER /home/docker/.minikube/machines/minikube/config.json

Error with minikube status: "X Error getting host status: load: filestore: open /home/docker/.minikube/machines/minikube/config.json: permission denied * * Sorry that minikube crashed. If this was unexpected, we would love to hear from you: - https://github.com/kubernetes/minikube/issues/new/choose"

-- Kashif Raza
Source: StackOverflow