개발

[kubernetes] k8s pod 가 반복 적으로 restart 되는 현상

eun2ce 2022. 9. 20. 09:54

 

k8s 위에 떠 있는 zookeeper 서비스에서 위와 같은 에러 로그가 뜨며 파드가 재실행되는 이슈가 있었습니다.

해결 과정은 아래와 같습니다.

 

zookeeper 의 상태 확인

  • pvc 기준으로 저장 공간의 사용량을 확인
  • 세 개의 파드가 정상적으로 연결되어있는지 확인

위에서 특별한 문제는 없었고, 서비스 로그도 정상적이었습니다.

 

 

파드가 비정상 종료된 원인 확인

Normal Pulled Container image "bitnami/zookeeper:3.6.2-debian-10-r0" already present on machine 2 minutes ago
Normal SandboxChanged Pod sandbox changed, it will be killed and re-created. 2 minutes ago
Warning Unhealthy Readiness probe failed: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: read init-p: connection reset by peer: unknown 14 minutes ago
Warning Unhealthy Liveness probe failed: OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: read init-p: connection reset by peer: unknown 16 minutes ago
Warning BackOff Back-off restarting failed container 30 minutes ago
Normal Killing Stopping container zookeeper 40 minutes ago
Warning Unhealthy (combined from similar events): Liveness probe failed: an hour ago

 

 

필자는 helm chart 를 이용해 zookeeper를 서비스 중인데 위와 같은 오류가 발생하는 경우나 상황은 많지만 running과 CrashLoopBackoff 상태를 반복하고 있다면 resources limit 을 확인할 필요가 있습니다.

 

최소 필요한 resources 를 충족시켜주지 못해 발생한 exception으로 resource를 늘려 해결했습니다.

 

https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/