![ビジーボックスポッドを起動できません](https://rvso.com/image/776323/%E3%83%93%E3%82%B8%E3%83%BC%E3%83%9C%E3%83%83%E3%82%AF%E3%82%B9%E3%83%9D%E3%83%83%E3%83%89%E3%82%92%E8%B5%B7%E5%8B%95%E3%81%A7%E3%81%8D%E3%81%BE%E3%81%9B%E3%82%93.png)
次のように 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