2015-10-19 106 views
2

编辑: 我有一个主节点和两个节点的OpenShift集群。我已经在节点上的主机和NFS客户机上安装了NFS。 我已经按照与NFS WordPress的例子:https://github.com/openshift/origin/tree/master/examples/wordpress无法挂载pod的卷

我做了以下关于我的主人为:OC登录-u系统:管理员:

mkdir /home/data/pv0001 
mkdir /home/data/pv0002 

chown -R nfsnobody:nfsnobody /home/data 

chmod -R 777 /home/data/ 

# Add to /etc/exports 
/home/data/pv0001 *(rw,sync,no_root_squash) 
/home/data/pv0002 *(rw,sync,no_root_squash) 

# Enable the new exports without bouncing the NFS service 
exportfs -a 

所以exportfs显示:

/home/data/pv0001 
     <world> 
/home/data/pv0002 
     <world> 

$ setsebool -P virt_use_nfs 1 


# Create the persistent volumes for NFS. 
# I did not change anything in the yaml-files 
$ oc create -f examples/wordpress/nfs/pv-1.yaml 
$ oc create -f examples/wordpress/nfs/pv-2.yaml 
$ oc get pv 

NAME  LABELS CAPACITY  ACCESSMODES STATUS  CLAIM  REASON 
pv0001 <none> 1073741824 RWO,RWX  Available    
pv0002 <none> 5368709120 RWO   Available  

这也是我得到的。 比我要我的节点:

oc login 
test-admin 

我创建一个WordPress项目:

oc new-project wordpress 

# Create claims for storage in my project (same namespace). 
# The claims in this example carefully match the volumes created above. 
$ oc create -f examples/wordpress/pvc-wp.yaml 
$ oc create -f examples/wordpress/pvc-mysql.yaml 
$ oc get pvc 

NAME   LABELS STATUS VOLUME 
claim-mysql map[]  Bound  pv0002 
claim-wp  map[]  Bound  pv0001 

这看起来完全一样的我。

启动MySQL窗格。

oc create -f examples/wordpress/pod-mysql.yaml 
oc create -f examples/wordpress/service-mysql.yaml 
oc create -f examples/wordpress/pod-wordpress.yaml 
oc create -f examples/wordpress/service-wp.yaml 

oc get svc 
NAME   LABELS         SELECTOR   IP(S)   PORT(S) 
mysql   name=mysql        name=mysql  172.30.115.137 3306/TCP 
wpfrontend  name=wpfrontend       name=wordpress 172.30.170.55 5055/TCP 

所以实际上everyting似乎工作!但是,当我要求我的荚状态,我得到如下:

[[email protected] pv0002]# oc get pod 
NAME  READY  STATUS                RESTARTS AGE 
mysql  0/1  Image: openshift/mysql-55-centos7 is ready, container is creating 0   6h 
wordpress 0/1  Image: wordpress is not ready on the node       0   6h 

豆荚未决状态,并在Web控制台他们给了以下错误:

12:12:51 PM  mysql Pod  failedMount  Unable to mount volumes for pod "mysql_wordpress": exit status 32 (607 times in the last hour, 41 minutes) 
12:12:51 PM  mysql Pod  failedSync Error syncing pod, skipping: exit status 32 (607 times in the last hour, 41 minutes) 
12:12:48 PM  wordpress Pod  failedMount  Unable to mount volumes for pod "wordpress_wordpress": exit status 32 (604 times in the last hour, 40 minutes) 
12:12:48 PM  wordpress Pod  failedSync Error syncing pod, skipping: exit status 32 (604 times in the last hour, 40 minutes) 

无法安装+超时。但是,当我将我的节点,我做了以下(测试我的节点上创建的目录):

mount -t nfs -v masterhostname:/home/data/pv0002 /test 

而且我把我的/测试的一些文件,我的节点上比它出现在我的主/我/ home/data/pv0002,似乎工作。 无法在OpenShift中挂载的原因是什么? 我一直坚持这一段时间。

日志:

Oct 21 10:44:52 ip-10-0-0-129 docker: time="2015-10-21T10:44:52.795267904Z" level=info msg="GET /containers/json" 
Oct 21 10:44:52 ip-10-0-0-129 origin-node: E1021 10:44:52.832179 1148 mount_linux.go:103] Mount failed: exit status 32 
Oct 21 10:44:52 ip-10-0-0-129 origin-node: Mounting arguments: localhost:/home/data/pv0002 /var/lib/origin/openshift.local.volumes/pods/2bf19fe9-77ce-11e5-9122-02463424c049/volumes/kubernetes.io~nfs/pv0002 nfs [] 
Oct 21 10:44:52 ip-10-0-0-129 origin-node: Output: mount.nfs: access denied by server while mounting localhost:/home/data/pv0002 
Oct 21 10:44:52 ip-10-0-0-129 origin-node: E1021 10:44:52.832279 1148 kubelet.go:1206] Unable to mount volumes for pod "mysql_wordpress": exit status 32; skipping pod 
Oct 21 10:44:52 ip-10-0-0-129 docker: time="2015-10-21T10:44:52.832794476Z" level=info msg="GET /containers/json?all=1" 
Oct 21 10:44:52 ip-10-0-0-129 docker: time="2015-10-21T10:44:52.835916304Z" level=info msg="GET /images/openshift/mysql-55-centos7/json" 
Oct 21 10:44:52 ip-10-0-0-129 origin-node: E1021 10:44:52.837085 1148 pod_workers.go:111] Error syncing pod 2bf19fe9-77ce-11e5-9122-02463424c049, skipping: exit status 32 
+0

检查托管您荚节点上的节点日志 - 。这是可能的卷mou如果遇到错误并提前回来, – Clayton

+0

还可以通过oc描述pod/name上的事件,该事件可能已被触发。 – Clayton

+0

oc desribe pod/name给出了相同的输出。也无法安装..状态32.可以手动安装。哪些日志?/var/log/messages? – lvthillo

回答

3

日志显示Oct 21 10:44:52 ip-10-0-0-129 origin-node: Output: mount.nfs: access denied by server while mounting localhost:/home/data/pv0002

所以它没有安装在本地主机上。 创建我的执着容积我执行该YAML:

{ 
    "apiVersion": "v1", 
    "kind": "PersistentVolume", 
    "metadata": { 
    "name": "registry-volume" 
    }, 
    "spec": { 
    "capacity": { 
     "storage": "20Gi" 
     }, 
    "accessModes": [ "ReadWriteMany" ], 
    "nfs": { 
     "path": "/home/data/pv0002", 
     "server": "localhost" 
    } 
    } 
} 

所以我安装到/home/data/pv0002但是这条道路并不在本地主机,但我的主服务器(这是ose3-master.example.com,所以我创造了我的PV中。一个错误的方式

{ 
    "apiVersion": "v1", 
    "kind": "PersistentVolume", 
    "metadata": { 
    "name": "registry-volume" 
    }, 
    "spec": { 
    "capacity": { 
     "storage": "20Gi" 
     }, 
    "accessModes": [ "ReadWriteMany" ], 
    "nfs": { 
     "path": "/home/data/pv0002", 
     "server": "ose3-master.example.com" 
    } 
    } 
} 

这也是在培训环境中我们推荐有你的集群之外的NFS服务器安装到