简体   繁体   English

Kubernetes pod从未做好准备

[英]Kubernetes pod never gets ready

I am setting up a small Kubernetes cluster using a VM (master) and 3 bare metal servers (all running Ubuntu 14.04). 我正在使用VM(主)和3个裸机服务器(都运行Ubuntu 14.04)建立一个小型Kubernetes集群。 I followed the Kubernetes install tutorial for Ubuntu . 我按照Ubuntu的Kubernetes 安装教程进行了操作 Each bare metal server also has 2T of disk space exported using Ceph 0.94.5 . 每个裸机服务器也有使用Ceph 0.94.5导出的2T磁盘空间。 Everything is working fine, but when I try to start a Replication Controller I get the following (kubectl get pods): 一切正常,但是当我尝试启动复制控制器时,我得到以下内容(kubectl get pods):

NAME          READY     STATUS                                         RESTARTS   AGE
site2-zecnf   0/1       Image: site-img is ready, container is creating    0      12m

The pod will be in this Not Ready state forever, but, if I kill it and start it again, it will run fine (sometimes I have to repeat this operation a few times though). pod将永远处于未就绪状态,但是,如果我将其杀死并再次启动它,它将运行良好(有时我必须重复此操作几次)。 Once the pod is running, everything works just fine. 一旦pod运行,一切正常。

If, for some reason, the pod dies, it's restarted by Kubernetes, but can enter in this Not Ready state again. 如果由于某种原因,该pod死亡,它由Kubernetes重新启动,但可以再次进入此未就绪状态。 Running: 运行:

kubectl describe pod java-site2-crctv

I get (some fields deleted): 我得到(删除了一些字段):

Namespace:          default
Status:             Pending
Replication Controllers:    java-site2 (1/1 replicas created)
Containers:
  java-site:
    Image:      javasite-img
    State:      Waiting
      Reason:       Image: javasite-img is ready, container is creating
    Ready:      False
    Restart Count:  0
Conditions:
  Type      Status
  Ready     False 
Events:
  FirstSeen             LastSeen            Count   From            SubobjectPath   Reason      Message
  Sat, 14 Nov 2015 12:37:56 -0200   Sat, 14 Nov 2015 12:37:56 -0200 1   {scheduler }                scheduled   Successfully assigned java-site2-crctv to 10.70.2.3
  Sat, 14 Nov 2015 12:37:57 -0200   Sat, 14 Nov 2015 12:45:29 -0200 46  {kubelet 10.70.2.3}         failedMount Unable to mount volumes for pod "java-site2-crctv_default": exit status 22
  Sat, 14 Nov 2015 12:37:57 -0200   Sat, 14 Nov 2015 12:45:29 -0200 46  {kubelet 10.70.2.3}         failedSync  Error syncing pod, skipping: exit status 22

The pod cannot mount the volume. 吊舱无法安装音量。 But, if I mount the volumes (rdb blocks) by hand in a local folder in all nodes, the problem is gone (pods start without problems). 但是,如果我手动将卷(rdb块)挂载到所有节点的本地文件夹中,问题就会消失(pods启动没有问题)。

It seems to me that Kubernetes isn't able to map them ( sudo rbd map java-site-vol ), only to mount them ( sudo mount /dev/rbd/rbd/java-site-vol /... ). 在我看来,Kubernetes无法映射它们( sudo rbd map java-site-vol ),只能挂载它们( sudo mount /dev/rbd/rbd/java-site-vol /... )。

Should I map all Ceph volumes that I use or should Kubernetes do that? 我应该映射我使用的所有Ceph卷还是Kubernetes应该这样做?

I finally solved the problem. 我终于解决了这个问题。 In the yaml files describing the Replication Controllers, I was using keyring: in the volume section: 在描述复制控制器的yaml文件中,我使用了keyring:在卷部分中:

keyring: "ceph.client.admin.keyring" 

After I generated a Ceph secret and changed the yaml files to use secretRef : 在我生成Ceph秘密并更改yaml文件以使用secretRef

secretRef:
  name: "ceph-secret"

Kubernetes was able to map and mount the Ceph volumes and the pods began to start normally. Kubernetes能够映射和安装Ceph卷,并且pod开始正常启动。 I don't know why using keyring: doesn't work in this case. 我不知道为什么使用keyring:在这种情况下不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM