web-dev-qa-db-ja.com

失敗したコンテナのバックオフ再起動-Minikubeでのポッドの同期エラー

ポッドを作成しようとすると、このエラーが発生します。 Ubuntu、Alpineのような非常に一般的な画像でも発生しています。私はKubernetesにかなり慣れていないため、Minikube Node(version v0.24.1)を使用しています

コマンド:

kubectl run ubuntu --image==ubuntu

エラー

Back-off restarting failed container - Error syncing pod

バージョン:

  • Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"**v1.8.0**", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/AMD64"}

  • Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"**v1.8.0**", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/AMD64"}

ポッドコマンドの記述:

Name:           ubuntunew-7567df64b8-mwc7x
Namespace:      default
Node:           minikube/192.168.99.102
Start Time:     Tue, 31 Jul 2018 14:48:35 +0530
Labels:         pod-template-hash=3123892064
                run=ubuntunew
Annotations:    kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"ubuntunew-7567df64b8","uid":"b3ba5547-94a2-11e8-91ce-080027df8e9...
Status:         Running
IP:             172.17.0.4
Created By:     ReplicaSet/ubuntunew-7567df64b8
Controlled By:  ReplicaSet/ubuntunew-7567df64b8
Containers:
  ubuntunew:
    Container ID:   docker://7871bcbd8a42164fd1168ed1955b75583e16d779fb609d39ebbb2c871e855b3b
    Image:          ubuntu
    Image ID:       docker-pullable://ubuntu@sha256:3f119dc0737f57f704ebecac8a6d8477b0f6ca1ca0332c7ee1395ed2c6a82be7
    Port:           <none>
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Tue, 31 Jul 2018 15:02:53 +0530
      Finished:     Tue, 31 Jul 2018 15:02:53 +0530
    Ready:          False
    Restart Count:  7
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-8nj4d (ro)
Conditions:
  Type           Status
  Initialized    True 
  Ready          False 
  PodScheduled   True 
Volumes:
  default-token-8nj4d:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-8nj4d
    Optional:    false
QoS Class:       BestEffort
Node-Selectors:  <none>
Tolerations:     <none>
Events:
  Type     Reason                 Age                 From               Message
  ----     ------                 ----                ----               -------
  Normal   Scheduled              15m                 default-scheduler  Successfully assigned ubuntunew-7567df64b8-mwc7x to minikube
  Normal   SuccessfulMountVolume  15m                 kubelet, minikube  MountVolume.SetUp succeeded for volume "default-token-8nj4d"
  Warning  BackOff                13m (x4 over 14m)   kubelet, minikube  Back-off restarting failed container
  Normal   Pulled                 13m (x4 over 14m)   kubelet, minikube  Successfully pulled image "ubuntu"
  Normal   Created                13m (x4 over 14m)   kubelet, minikube  Created container
  Normal   Started                13m (x4 over 14m)   kubelet, minikube  Started container
  Normal   Pulling                10m (x6 over 15m)   kubelet, minikube  pulling image "ubuntu"
  Warning  FailedSync             39s (x52 over 14m)  kubelet, minikube  Error syncing pod

奇妙なことに、それはnginxイメージに対して機能します。

15
Ram Krishnan

Describe Podコマンドリストによると、ポッド内のコンテナはexit code 0ですでに完了しています。これは、エラー/問題なしで正常に完了したことを示していますが、Podのライフサイクルはとても短い。ポッドを継続的に実行するには、決して終了しないタスクを指定する必要があります。

apiVersion: v1
kind: Pod
metadata:
  name: ubuntu
spec:
  containers:
  - name: ubuntu
    image: ubuntu
    command: [ "/bin/bash", "-ce", "tail -f /dev/null" ]

より多くのヒントを見つけることができます ここ

20
mk_sta