flannel 一直 CrashLoopBackOff
问题
flannel 一直 CrashLoopBackOff
同时 coredns-65c54cc984-bttxq 所在 pod 一直 ContainerCreating 状态
解决方案
- 查看日志(注意修改pod名称)
kubectl logs kube-flannel-ds-njqnd -n kube-system
- 报错
Error registering network: failed to acquire lease: subnet "10.244.0.0/16" specified in the flannel net config doesn't contain "172.16.0.0/24" PodCIDR of the "k8s-master" node.
修改 kube-flannel.yml (根据自己实际报错修改)
"Network": "10.244.0.0/16",
改为
"Network": "172.16.0.0/16",
删除重新apply即可
Kubernetes挂载NFS报错
问题
Unable to attach or mount volumes: unmounted volumes=[nfs-client-root], unattached volumes=[nfs-client-root kube-api-access-p5nrm]: timed out waiting for the condition
MountVolume.SetUp failed for volume "nfs-pv-nfs-storage" : mount failed: exit status 32 Mounting command: mount Mounting arguments: -t nfs zhizhuxia:/root/nfs_root /var/lib/kubelet/pods/82c370d9-9c50-4305-a4e2-040c70010629/volumes/kubernetes.io~nfs/nfs-pv-nfs-storage Output: mount: /var/lib/kubelet/pods/82c370d9-9c50-4305-a4e2-040c70010629/volumes/kubernetes.io~nfs/nfs-pv-nfs-storage: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.
解决方案
需要在各个master和node节点上执行如下
安装nfs客户端工具
sudo apt install nfs-common