[kubernetes]-挂载nfs出错排查

kubect describe pod 提示下面的日志
Warning  FailedMount  96s    kubelet, k8s-op-n01  Unable to mount volumes for pod "zbox-dp-799c8c4f57-jhk8p_default(fc77befc-597e-11ea-ba61-00163e0d21c0)": timeout expired waiting for volumes to attach or mount for pod "default"/"zbox-dp-799c8c4f57-jhk8p". list of unmounted volumes=[zbox-data]. list of unattached volumes=[zbox-data default-token-w742g]
  Warning  FailedMount  94s    kubelet, k8s-op-n01  MountVolume.SetUp failed for volume "nfs-pv" : mount failed: exit status 32
Mounting command: systemd-run
Mounting arguments: --description=Kubernetes transient mount for /var/lib/kubelet/pods/fc77befc-597e-11ea-ba61-00163e0d21c0/volumes/kubernetes.io~nfs/nfs-pv --scope -- mount -t nfs 192.168.13.212:/opt/zbox /var/lib/kubelet/pods/fc77befc-597e-11ea-ba61-00163e0d21c0/volumes/kubernetes.io~nfs/nfs-pv
Output: Running scope as unit run-17269.scope.
mount.nfs: Connection refused

这里以为是镜像的问题 没考虑到nfs server的问题

启动一个基础镜像并测试命令

yum install -y nfs-utils
systemctl enable rpcbind.service
systemctl start rpcbind.service

发现提示D-Bus 不允许启动systemctl

查了资料发现 官方提供的镜像都不允许使用systemctl 也算是意外收获吧

使用下面的方法 启动尝试
docker run -itd   --name=sys-test-2 --privileged -e "container=docker"   harbor.aircourses.com/kubernetes/jdk-1.8.0_161:v1  /usr/sbin/init

systemctl的确可以了

但是问题还是存在

后面直接在服务器测试挂载nfs 也不行。

排查之后确认

nfs 卸载的时候 出现busy 我直接重启了nfs-server ,然后client端上目录没有卸载,而且无法cd进去,可能是这个问题

重载一下再启动
# 重载一下再启动
systemctl daemon-reload
systemctl restart rpcbind.socket
systemctl start nfs

可以了

发布了300 篇原创文章 · 获赞 25 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/xujiamin0022016/article/details/104571913