服务从未运行

时间:2018-01-30 22:34:48

标签: kubernetes minikube

我在Linux上使用minikube开始使用kubernetes。继续自述文件中的示例并使用none vm-diver,我会执行以下操作。

$ 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

现在,问题是这个pod继续保持待定状态。看起来没有节点可以运行它,但我不知道为什么。我哪里错了?

编辑:以下是describe广告连播的输出。

$ 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

1 个答案:

答案 0 :(得分:0)

尝试运行minikube状态(如果获得此状态),然后尝试运行此命令。 修复对我有用: 须藤chown -R $ USER /home/docker/.minikube/machines/minikube/config.json

minikube状态错误: “ X错误获取主机状态:加载:文件存储:打开/home/docker/.minikube/machines/minikube/config.json:权限被拒绝 * *对不起,迷你库崩溃了。如果这是意外情况,我们很想收到您的来信:   -https://github.com/kubernetes/minikube/issues/new/choose

相关问题