[root@master wordpress]# kubectl get pods
NAME                     READY     STATUS              RESTARTS   AGE
mysql-r40wj              0/1       ContainerCreating   0          7m

排查:

[root@master wordpress]# kubectl describe pods -l app=mysql
MountVolume.SetUp failed for volume "kubernetes.io/nfs/690bf99f-ba01-11ea-bdcf-000c298e5202-pv0001" (spec.Name: "pv0001") pod "690bf99f-ba01-11ea-bdcf-000c298e5202" (UID: "690bf99f-ba01-11ea-bdcf-000c298e5202") with: mountfailed: exit status 32
Mounting command: mount            显示挂载失败

解决方法:

在node1和node2执行下面命令:
yum install -y nfs-utils-*
mkdir /data /code
vim /etc/exports
/data 10.0.0.0/24(rw,async,no_root_squash,no_all_squash)
/code 10.0.0.0/24(rw,async,no_root_squash,no_all_squash)

systemctl restart rpcbind
systemctl restart nfs
systemctl enable rpcbind
systemctl enable nfs

问题解决:

[root@master wordpress]# kubectl get pods
NAME                     READY     STATUS    RESTARTS   AGE
mysql-r40wj              1/1       Running   0          10m
[root@master wordpress]# kubectl get svc
mysql        10.254.189.142   <none>        3306/TCP       2s
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐