이쿠의 슬기로운 개발생활

함께 성장하기 위한 보안 개발자 EverNote 내용 공유

Kubernetes/Kubernetes 에러 경험

오류 : inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory

이쿠우우 2021. 1. 12. 21:12
반응형

 

 

 

오류 : inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory

 

상황

cAdvisor git에 있는 kubernetes deploy인 아래의 링크를 참고해서 

https://github.com/google/cadvisor/blob/master/deploy/kubernetes/base/daemonset.yaml

kubernetes cluster에 cAdvisor Daemonset 를 배포했는데 

다음과 같은 오류가 발생함.

 

[오류 메세지]

Could not configure a source for OOM detection, disabling OOM events: open /dev/kmsg: no such file or directory

Failed to start container manager: inotify_add_watch /sys/fs/cgroup/cpuacct,cpu: no such file or directory

none of the resources are being tracked.

 

 

원인

해당 오류는 volume mount에 관한 오류임.

/sys/fs/cgroup 에 mount할 volume이 명시되어있지 않아서

pod가 정상적으로 running 되지 못함.

 

 

해결책

아래의 빨간부분과 같이 cgroup 관련 volume을 추가해줘야함

host에 / 경로에 cgroup 디렉터리도 생성해줘야함

apiVersion: apps/v1 # for Kubernetes versions before 1.9.0 use apps/v1beta2
kind: DaemonSet
metadata:
  name: cadvisor
  namespace: cadvisor
spec:
  selector:
    matchLabels:
      name: cadvisor
  template:
    metadata:
      labels:
        name: cadvisor
    spec:
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule
      containers:
      - name: cadvisor
        image: google/cadvisor:latest
        securityContext:
          privileged: true
        resources:
          requests:
            memory: 200Mi
            cpu: 150m
          limits:
            memory: 2000Mi
            cpu: 300m
        volumeMounts:
        - name: rootfs
          mountPath: /rootfs
          readOnly: true
        - name: var-run
          mountPath: /var/run
          readOnly: true
        - name: sys
          mountPath: /sys
          readOnly: true
        - name: docker
          mountPath: /var/lib/docker
          readOnly: true
        - name: disk
          mountPath: /dev/disk
          readOnly: true
        - name: cgroup
          mountPath: /sys/fs/cgroup
          readOnly: true
        ports:
          - name: http
            containerPort: 8080
            protocol: TCP
      automountServiceAccountToken: false
      terminationGracePeriodSeconds: 30
      volumes:
      - name: rootfs
        hostPath:
          path: /
      - name: var-run
        hostPath:
          path: /var/run
      - name: sys
        hostPath:
          path: /sys
      - name: docker
        hostPath:
          path: /var/lib/docker
      - name: disk
        hostPath:
          path: /dev/disk
      - name: cgroup
        hostPath:
          path: /cgroup

 

 

 

 

 


제 글을 복사할 시 출처를 명시해주세요.
글에 오타, 오류가 있다면 댓글로 알려주세요! 바로 수정하겠습니다!


 

 

 

반응형