polardbx-operator install MountVolume.SetUp failed for volume "etclocaltime" : hostPath type check failed: /etc/localtime is not a file
wyzhl126 opened this issue · comments
环境单机docker安装的rancher单节点 上安装
[root@test]# kubectl -n polardbx get pods
NAME READY STATUS RESTARTS AGE
polardbx-c00-gt96-dn-0-cand-0 0/3 ContainerCreating 0 24m
polardbx-c00-gt96-dn-0-cand-1 0/3 ContainerCreating 0 24m
polardbx-c00-gt96-dn-0-log-0 0/3 ContainerCreating 0 24m
polardbx-c00-gt96-gms-cand-0 0/3 ContainerCreating 0 24m
polardbx-c00-gt96-gms-cand-1 0/3 ContainerCreating 0 24m
polardbx-c00-gt96-gms-log-0 0/3 ContainerCreating 0 24m
polardbx-controller-manager-7b4f47dfcf-5txkz 1/1 Running 0 38m
polardbx-hpfs-2fq8x 1/1 Running 0 38m
polardbx-tools-updater-jd829 1/1 Running 0 38m
kubectl -n polardbx describe pod polardbx-c00-gt96-dn-0-cand-0
Events:
Type Reason Age From Message
Normal Scheduled 17s default-scheduler Successfully assigned polardbx/polardbx-c00-gt96-dn-0-cand-0 to dz-fanjie
Warning FailedMount 2s (x6 over 17s) kubelet MountVolume.SetUp failed for volume "etclocaltime" : hostPath type check failed: /etc/localtime is not a file
Warning FailedMount 2s (x6 over 17s) kubelet MountVolume.SetUp failed for volume "zoneinfo" : hostPath type check failed: /usr/share/zoneinfo is not a directory
出现上述错误,宿主机及docker容器都有上面的2个目录。
@wyzhl126 It seems to be a result of the containerized kubelet process in RKE and Rancher launched Kubernetes clusters. In your host, the kubelet is running in a container, and the path /etc/localtime
, /usr/share/zoneinfo
(mount type is Directory
instead DirectoryOrCreate
) dose not be mounted in the kubelet container. So the hostPath type check failed.
Following are some related issues:
rancher/rancher#22882
rancher/rancher#14836
Workaround:
Edit your cluster config in rancher cluster management page, add extra_binds
into kubelet service as the following:
services:
kubelet:
extra_binds:
- '/etc/localtime:/etc/localtime'
- '/usr/share/zoneinfo:/usr/share/zoneinfo'