问题描述
我正在尝试在复制控制器中安装外部 nfs 共享.当我创建复制控制器时,pod 处于挂起状态.获取有关 pod 的详细信息,我得到以下事件:
I'm trying to mount an external nfs share in a Replication Controller. When I create the replication controller, the pod is pending. Getting the details on the pod, I get these events:
Events:
FirstSeen LastSeen Count From SubobjectPath Reason Message
Thu, 05 Nov 2015 11:28:33 -0700 Thu, 05 Nov 2015 11:28:33 -0700 1 {scheduler } scheduled Successfully assigned web-worker-hthjq to jolt-server-5
Thu, 05 Nov 2015 11:28:43 -0700 Thu, 05 Nov 2015 11:28:43 -0700 1 {kubelet jolt-server-5} failedMount Unable to mount volumes for pod "web-worker-hthjq_default": exit status 32
Thu, 05 Nov 2015 11:28:43 -0700 Thu, 05 Nov 2015 11:28:43 -0700 1 {kubelet jolt-server-5} failedSync Error syncing pod, skipping: exit status 32
我的设置是本地机器上的一个主节点和一个节点.这些机器正在运行 CoreOS.nfs 共享存在于网络上的另一台机器上.如果我进入主机,我可以成功挂载 nfs 共享,所以我相信导出配置正确.在网上环顾四周,似乎使用 nfs 共享的唯一示例是 Kubernetes 中定义的那些(一个 pod 与另一个共享).有没有办法直接从 Kubernetes 挂载外部共享(我不想把它挂载到主机然后从主机挂载到容器).
My set up is one master and one node on local machines. These machines are running CoreOS. The nfs share exists on another machine on the network. If I shell into the host machine, I can successfully mount the nfs share, so I believe the export is configured correctly. Looking around online, it seems like the only examples of using nfs shares are those defined within Kubernetes (one pod sharing with another). Is there not a way to mount an external share directly from Kubernetes (I don't want to have to mount it to the host machine and then mount from the host machine to the container).
这是我的复制控制器:
apiVersion: v1
kind: ReplicationController
metadata:
labels:
name: web-worker
name: web-worker
spec:
replicas: 1
selector:
component: web-worker
template:
metadata:
labels:
app: task-queue
component: web-worker
spec:
containers:
- command:
- /sbin/my_init
image: quincy/php-apache2:latest
name: web-worker
ports:
- containerPort: 80
protocol: TCP
volumeMounts:
- name: code-base
mountPath: /var/www/html
- name: local-secrets
mountPath: /secrets
volumes:
- name: code-base
nfs:
server: thuey.jolt.local
path: "/Users/thuey/Sites/jolt/jolt-web"
- name: local-secrets
secret:
secretName: local-secret
更新
想了想,发现问题可能是找不到服务器(thuey.jolt.local).它可能只是在查看内部 DNS.那是准确的吗?如果是这样,有什么办法可以解决吗?
After thinking about it more, I realized the problem is probably that it can't find the server (thuey.jolt.local). It's probably just looking at the internal DNS. Is that accurate? If so, is there any way around that?
更新
再次尝试后,它现在可以直接从 pod 挂载到联网的 nfs 服务器.
After attempting this again, it is now working mounting directly from the pod to the networked nfs server.
推荐答案
在@rwehner 的帮助下,我终于弄清楚了.检查 kubelet 日志发现:
With @rwehner's help, I was finally able to figure it out. Checking the kubelet log revealed:
输出:mount.nfs: rpc.statd 未运行但远程锁定需要.
一旦我开始运行 rpcbind,挂载就开始工作了.
As soon as I got rpcbind running, the mount worked.
这篇关于NFS 卷挂载导致 Kubernetes 中的退出代码为 32?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!