다음과 같이 Kubernetes 포드를 시작하면 실패합니다.
k run bb --image=busybox
k describe pod bb
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Pulling 14m (x35 over 164m) kubelet Pulling image "busybox"
Warning BackOff 4m23s (x736 over 164m) kubelet Back-off restarting failed container
이유는 무엇입니까?
명령 이 이미지 run
에 제대로 작동합니다 nginx
.
답변1
busybox
서버가 아닙니다. 끝없는 "입력 듣기" 루프를 시작하지 않습니다.
이미지 에서도 마찬가지입니다 alpine
.
하지만 다음과 같이 무한 루프를 만들 수 있습니다.
apiVersion: v1
kind: Pod
metadata:
name: bb
spec:
containers:
- image: busybox
command: ['sh', '-c', 'while true; do date; sleep 3; done']
name: bb
k apply -f bb.yaml
k describe pod bb
...
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 6s default-scheduler Successfully assigned default/bb to minikube-m02
Normal Pulling 5s kubelet Pulling image "busybox"
Normal Pulled 3s kubelet Successfully pulled image "busybox" in 2.256262371s
Normal Created 3s kubelet Created container bb
Normal Started 3s kubelet Started container bb
그리고 로그를 볼 수 있습니다:
guettli@p15:~/.kube$ k logs bb
Fri Apr 8 20:38:30 UTC 2022
Fri Apr 8 20:38:33 UTC 2022
Fri Apr 8 20:38:36 UTC 2022