记录k8s进行持续挂卷,但是pod并没有running的问题
在进行持续挂卷,必须配置pv和pvc
但是配置了mysql之后pod并没有running,我的解决步骤
一、查看kubectl describe pod mysql-72bl7
Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ------ ------- 32s 32s 1 {default-scheduler } Normal Scheduled Successfully assigned mysql-72bl7 to k8s-node1 32s 0s 7 {kubelet k8s-node1} Warning FailedMount MountVolume.SetUp failed for volume "kubernetes.io/nfs/07675a6c-aea6-11ed-b2e9-000c29cad910-mysql" (spec.Name: "mysql") pod "07675a6c-aea6-11ed-b2e9-000c29cad910" (UID: "07675a6c-aea6-11ed-b2e9-000c29cad910") with: mount failed: exit status 32 Mounting command: mount Mounting arguments: 192.168.223.136:/data/mysql /var/lib/kubelet/pods/07675a6c-aea6-11ed-b2e9-000c29cad910/volumes/kubernetes.io~nfs/mysql nfs [] Output: mount.nfs: access denied by server while mounting 192.168.223.136:/data/mysql
二、描述显示我的挂卷找不到的情况。首先查找之间的目录是否存在该目录/data/mysql 确认是存在的
三、查看系统日志
cat /var/log/messages | grep mount
Feb 17 01:30:47 k8s-master rpc.mountd[118167]: refused mount request from 192.168.223.135 for /data/mysql (/data/mysql): unmatched host Feb 17 01:31:52 k8s-master rpc.mountd[118167]: refused mount request from 192.168.223.135 for /data/mysql (/data/mysql): unmatched host Feb 17 01:32:43 k8s-master rpc.mountd[118167]: refused mount request from 192.168.223.135 for /data/mysql (/data/mysql): unmatched host Feb 17 01:32:44 k8s-master rpc.mountd[118167]: refused mount request from 192.168.223.135 for /data/mysql (/data/mysql): unmatched host Feb 17 01:32:45 k8s-master rpc.mountd[118167]: refused mount request from 192.168.223.135 for /data/mysql (/data/mysql): unmatched host
判断应该是我的nfs步骤出现了问题,尝试showmount -e 192.168.223.136
发现不正常,没有弹出该路径
[root@zheng mysql]# showmount -e 192.168.223.136 Export list for 192.168.223.136:
排查是自己的nfs路径的同步打错了。
正确应该是这样的,错打成了s,改过来之后,重启pod,完美解决。
这是一个记录排查的过程,虽然是小问题,但是可以避免的。
同时也注意,如果可以复制最好,手打出现语法错误是很坑的事情。