gpt4 book ai didi

Kubernetes NFS 卷挂载失败,退出状态为 32

转载 作者:IT老高 更新时间:2023-10-28 21:25:02 25 4
gpt4 key购买 nike

我的 Ubuntu 机器上安装了 Kubernetes 设置。我正在尝试根据此 http://kubernetes.io/v1.1/examples/nfs/ 设置一个 nfs 卷并将其安装到容器中文档。

nfs 服务和 pod 配置

kind: Service
apiVersion: v1
metadata:
name: nfs-server
spec:
ports:
- port: 2049
selector:
role: nfs-server
---
apiVersion: v1
kind: Pod
metadata:
name: nfs-server
labels:
role: nfs-server
spec:
containers:
- name: nfs-server
image: jsafrane/nfs-data
ports:
- name: nfs
containerPort: 2049
securityContext:
privileged: true

pod配置挂载nfs卷

apiVersion: v1
kind: Pod
metadata:
name: nfs-web
spec:
containers:
- name: web
image: nginx
ports:
- name: web
containerPort: 80
volumeMounts:
# name must match the volume name below
- name: nfs
mountPath: "/usr/share/nginx/html"
volumes:
- name: nfs
nfs:
# FIXME: use the right hostname
server: 192.168.3.201
path: "/"

当我运行 kubectl describe nfs-web 时,我得到以下输出,提到它无法挂载 nfs 卷。这可能是什么原因?

Name:               nfs-web
Namespace: default
Image(s): nginx
Node: 192.168.1.114/192.168.1.114
Start Time: Sun, 06 Dec 2015 08:31:06 +0530
Labels: <none>
Status: Pending
Reason:
Message:
IP:
Replication Controllers: <none>
Containers:
web:
Container ID:
Image: nginx
Image ID:
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment Variables:
Conditions:
Type Status
Ready False
Volumes:
nfs:
Type: NFS (an NFS mount that lasts the lifetime of a pod)
Server: 192.168.3.201
Path: /
ReadOnly: false
default-token-nh698:
Type: Secret (a secret that should populate this volume)
SecretName: default-token-nh698
Events:
FirstSeen LastSeen Count From SubobjectPath Reason Message
───────── ──────── ───── ──── ───────────── ────── ───────
36s 36s 1 {scheduler } Scheduled Successfully assigned nfs-web to 192.168.1.114
36s 2s 5 {kubelet 192.168.1.114} FailedMount Unable to mount volumes for pod "nfs-web_default": exit status 32
36s 2s 5 {kubelet 192.168.1.114} FailedSync Error syncing pod, skipping: exit status 32

最佳答案

我遇到了同样的问题,我通过在每个 Kubernetes 节点中安装 nfs-common 解决了这个问题。

apt-get install -y nfs-common

我的节点是在没有 nfs-common 的情况下安装的。 Kubernetes 将要求每个节点将 NFS 挂载到特定目录中,以供 pod 使用。由于未找到 mount.nfs,因此挂载过程失败。

祝你好运!

关于Kubernetes NFS 卷挂载失败,退出状态为 32,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34113569/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com