Description

When deployed by kubespray and the kubelet runs in in docker(kubelet_deployment_type: docker),kubelet will try to find the path setted by hostPath(a volume type when mounting a volume in pod) inside its container instead of on the host filesystem, which results in the error in kubelet, for example:”Error: lstat /opt/test: no such file or directory”

The code of kubelet(pkg/kubelet/kueblet_pods.go):
hostPath will lead to error when kubelet deployed in container and used with subPath

From the code we can see that when mount.SubPath is setted,kubelet will execute fileinfo, err := os.Lstat(hostPath) in code. Kubelet won’t find the path if it is running in container and with no host volume related mounted.

From the events we can see:
hostPath will lead to error when kubelet deployed in container and used with subPath
If subPath is not setted in yaml, kubelet with not execute fileinfo, err := os.Lstat(hostPath) and there will not be such problem.

Related Issues

https://github.com/kubernetes-incubator/kubespray/issues/1715
https://github.com/kubernetes/kubernetes/issues/56339

相关文章:

  • 2021-11-04
  • 2021-09-14
  • 2021-12-09
  • 2021-08-09
  • 2021-06-09
  • 2022-02-08
  • 2021-10-20
  • 2022-03-08
猜你喜欢
  • 2022-03-05
  • 2021-09-28
  • 2022-12-23
  • 2021-10-23
  • 2022-12-23
  • 2021-05-18
  • 2021-12-05
相关资源
相似解决方案