Recuo ao reiniciar o contêiner com falha - Erro ao sincronizar o pod no Minikube

15

Estou enfrentando esse erro ao tentar criar pods. Está ocorrendo com imagens muito comuns, como o Ubuntu, o Alpine também. Sou bastante novo no Kubernetes e estou usando um Minikube Node (versão v0.24.1)

Comando:

kubectl run ubuntu --image==ubuntu

Erro :

Back-off restarting failed container - Error syncing pod

Versões:

  • 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"}

Descrever o comando Pod:

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

Curiosamente, ele funciona para a imagem nginx.

Ram Krishnan
fonte

Respostas:

19

De acordo com a Describe Podlista de comandos, seu contêiner dentro do Pod já foi concluído exit code 0, o que indica a conclusão bem-sucedida sem erros / problemas, mas o ciclo de vida do mesmo Podfoi muito curto. Para manter o Pod funcionando continuamente, você deve especificar uma tarefa que nunca será concluída.

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

Você pode encontrar mais dicas aqui .

mk_sta
fonte