1. 背景:
    2. kubernetes 1.19.6的环境下,机器掉电以后重启就遇到这种问题:
    3. 然后查看APP Pod的logs发现: Warning Failed 12m kubelet Error: failed to start container "sm-container": Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting "/var/lib/lxcfs/proc/cpuinfo" to rootfs at "/var/lib/docker/overlay2/599fd800766fd7b52eee3183be2a7005a6494e7534ea8aa276c93b7ebb71313b/merged/proc/cpuinfo" caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
    4. 都是和/var/lib/lxcfs/proc/cpuinfo 这个有关。
    5. 然后观察lxcfs的pod发现:
    6. [root@allinone-worker0]# kubectl get pods
    7. NAME READY STATUS RESTARTS AGE
    8. local-pv-provisioner-ggn6c 1/1 Running 2 9d
    9. lxcfs-jf5sk 0/1 CrashLoopBackOff 1 8s # 此时发现:LXCFS的pod一直在重启。查看其log:
    10. pod-demo-sriov-kerne-1 1/1 Running 1 2d3h
    11. pod-demo-sriov-kernel 1/1 Running 1 2d3h
    12. [root@allinone-worker0]# kubectl logs -f lxcfs-jf5sk
    13. mount namespace: 5
    14. hierarchies:
    15. 0: fd: 6: memory
    16. 1: fd: 7: freezer
    17. 2: fd: 8: devices
    18. 3: fd: 9: blkio
    19. 4: fd: 10: cpuset
    20. 5: fd: 11: net_prio,net_cls
    21. 6: fd: 12: pids
    22. 7: fd: 13: perf_event
    23. 8: fd: 14: hugetlb
    24. 9: fd: 15: cpuacct,cpu
    25. 10: fd: 16: name=systemd
    26. fuse: mountpoint is not empty
    27. fuse: if you are sure this is safe, use the 'nonempty' mount option
    28. 问题到这里就基本上描述清楚。然后查了一下资料:
    • 1.TS LXCFS ```properties 1.解决: rm -rf /var/lib/lxcfs && kubectl delete pods $LXCFS_POD

    整体过程:

          - name: mem
            hostPath:
              path: /var/lib/lxcfs/proc/meminfo
          - name: cpu
            hostPath:
              path: /var/lib/lxcfs/proc/cpuinfo
          - name: stat
            hostPath:
              path: /var/lib/lxcfs/proc/stat
          - name: uptime
            hostPath:
              path: /var/lib/lxcfs/proc/uptime
          - name: swaps
            hostPath:
              path: /var/lib/lxcfs/proc/swaps
    
    
        volumeMounts:
          - name: *vc0
            mountPath: /data
            readOnly: false
    
          - name: *vc1
            mountPath: /var/lib/etcd
            readOnly: false
    
          - mountPath: /sys
            name: sys
            readOnly: false
    
          - mountPath: /etc/podinfo
            name: podinfo
    
          - name: mem
            mountPath: /proc/meminfo
    
          - name: cpu
            mountPath: /proc/cpuinfo
    
          - name: stat
            mountPath: /proc/stat
    
          - name: uptime
            mountPath: /proc/uptime
    
          - name: swaps
            mountPath: /proc/swaps
    

    Events: Type Reason Age From Message


    Normal Scheduled 12m default-scheduler Successfully assigned bond/asbc-sm-0 to 10.2.50.251 Warning Failed 12m kubelet Error: failed to start container “sm-container”: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting “/var/lib/lxcfs/proc/cpuinfo” to rootfs at “/var/lib/docker/overlay2/599fd800766fd7b52eee3183be2a7005a6494e7534ea8aa276c93b7ebb71313b/merged/proc/cpuinfo” caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Warning Failed 12m kubelet Error: failed to start container “sm-container”: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting “/var/lib/lxcfs/proc/uptime” to rootfs at “/var/lib/docker/overlay2/2acc042211d079e39c789f2a6208cd9a7195b01ed93bf5e32bc3dafd9e83c987/merged/proc/uptime” caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Warning Failed 12m kubelet Error: failed to start container “sm-container”: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting “/var/lib/lxcfs/proc/cpuinfo” to rootfs at “/var/lib/docker/overlay2/50ac7b86d86b96a1db3a33e42d417dc74c0f55d12f40b9d29d1378ebdfe78bf6/merged/proc/cpuinfo” caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Warning Failed 12m kubelet Error: failed to start container “sm-container”: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting “/var/lib/lxcfs/proc/stat” to rootfs at “/var/lib/docker/overlay2/d86fc168758d656ba0537bfabb893d3a731b96ea8e21e20cb6724013da5c8c36/merged/proc/stat” caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Normal Created 11m (x5 over 12m) kubelet Created container sm-container Normal Pulled 11m (x5 over 12m) kubelet Container image “10.2.50.251:5000/asbc_sm:latest” already present on machine Warning Failed 11m kubelet Error: failed to start container “sm-container”: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: process_linux.go:459: container init caused: rootfs_linux.go:59: mounting “/var/lib/lxcfs/proc/stat” to rootfs at “/var/lib/docker/overlay2/eeac2c547ef349f3b979e5cd3f2e32412b1984190d845b8c8fecdb87bb0a1d59/merged/proc/stat” caused: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type Warning BackOff 2m47s (x46 over 12m) kubelet Back-off restarting failed container

    [root@allinone-worker0 ASBC]# kubectl get pods NAME READY STATUS RESTARTS AGE local-pv-provisioner-ggn6c 1/1 Running 2 9d lxcfs-jf5sk 0/1 CrashLoopBackOff 1 8s pod-demo-sriov-kerne-1 1/1 Running 1 2d3h pod-demo-sriov-kernel 1/1 Running 1 2d3h

    [root@allinone-worker0 ASBC]# kubectl logs -f lxcfs-jf5sk mount namespace: 5 hierarchies: 0: fd: 6: memory 1: fd: 7: freezer 2: fd: 8: devices 3: fd: 9: blkio 4: fd: 10: cpuset 5: fd: 11: net_prio,net_cls 6: fd: 12: pids 7: fd: 13: perf_event 8: fd: 14: hugetlb 9: fd: 15: cpuacct,cpu 10: fd: 16: name=systemd fuse: mountpoint is not empty fuse: if you are sure this is safe, use the ‘nonempty’ mount option

    rm -rf /var/lib/lxcfs && kubectl delete pods $LXCFS_POD ```