서버가 생성된 후 cloud-init 프로세스가 오랜 시간 동안 실행되는 이유는 무엇입니까?

서버가 생성된 후 cloud-init 프로세스가 오랜 시간 동안 실행되는 이유는 무엇입니까?

새로운 Ubuntu 18.04 클라우드 서버를 시작하고 cloud-init도커를 설치하는 데 사용하고 있습니다. 파일을 검사해 보면 cloud-init프로세스가 실행 중이고 잘 완료되고 있음을 알 수 있습니다 /var/log/cloud-init-output.log. 하지만 cloud-init이 후에도 여러 프로세스가 여전히 오랫동안 실행되어 CPU를 잡아먹고 있는 것을 발견했습니다 .

여기에 이미지 설명을 입력하세요.

이러한 cloud-init프로세스는 약 30초마다 목록에 나타나고 top사라졌다가 다시 돌아옵니다. 이 문제를 더 자세히 진단할 수 있는 방법이 있습니까? cloud-init분명히 완료된 후에도 계속 실행되는 이유는 무엇이며 프로세스가 너무 많은 이유는 무엇입니까?

또한 동일한 패턴을 따르는 것처럼 보이는 정기적인 스파이크가 있는 CPU 추적도 보았습니다.

여기에 이미지 설명을 입력하세요.

그것을 보니 /var/log/cloud-init.log30초마다 미쳐가며 다음을 출력하고 몇 줄을 계속해서 반복하는 것을 발견했습니다.

2021-11-13 19:21:25,927 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:25,928 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:25,928 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:25,928 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:25,928 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:25,931 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:25,932 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:25,932 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:25,932 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:25,932 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:25,932 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:25,932 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.058 seconds (0.06)
2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,035 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:26,035 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:26,036 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:26,036 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:26,039 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:26,039 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:26,039 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,039 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,039 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:26,040 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,040 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:26,040 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:26,040 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:26,040 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.054 seconds (0.06)
2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: hotplug-hook called with the following arguments: {hotplug_action: query, subsystem: net, udevaction: None, devpath: None}
2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,054 - hotplug_hook.py[DEBUG]: Fetching datasource
2021-11-13 19:21:26,054 - handlers.py[DEBUG]: start: hotplug-hook/check-cache: attempting to read from cache [trust]
2021-11-13 19:21:26,055 - util.py[DEBUG]: Reading from /var/lib/cloud/instance/obj.pkl (quiet=False)
2021-11-13 19:21:26,055 - util.py[DEBUG]: Read 18131 bytes from /var/lib/cloud/instance/obj.pkl
2021-11-13 19:21:26,058 - util.py[DEBUG]: Reading from /run/cloud-init/.instance-id (quiet=False)
2021-11-13 19:21:26,058 - util.py[DEBUG]: Read 9 bytes from /run/cloud-init/.instance-id
2021-11-13 19:21:26,058 - stages.py[DEBUG]: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook/check-cache: SUCCESS: restored from cache with run check: DataSourceHetzner
2021-11-13 19:21:26,058 - hotplug_hook.py[DEBUG]: hotplug not supported for event of type net
2021-11-13 19:21:26,058 - handlers.py[DEBUG]: finish: hotplug-hook: SUCCESS: Handle reconfiguration on hotplug events
2021-11-13 19:21:26,059 - hotplug_hook.py[DEBUG]: Exiting hotplug handler
2021-11-13 19:21:26,059 - util.py[DEBUG]: Reading from /proc/uptime (quiet=False)
2021-11-13 19:21:26,059 - util.py[DEBUG]: Read 17 bytes from /proc/uptime
2021-11-13 19:21:26,059 - util.py[DEBUG]: cloud-init mode 'hotplug-hook' took 0.057 seconds (0.05)

답변1

#cloud-init IRC 채널의 유용한 채팅에 따르면 이는 며칠 후 출시된 21.4에서 수정된 cloud-init 버전 21.3의 문제와 관련이 있는 것으로 보입니다.

그때까지 해결 방법은 다음과 같습니다.

rm -f /lib/udev/rules.d/10-cloud-init-hook-hotplug.rules
sudo udevadm control --reload-rules

관련 정보