pod信息

apiVersion: v1
kind: Pod
metadata:
  name: my-vm01
spec:
  containers:
  - name: vm
    image: ubuntu
    imagePullPolicy: IfNotPresent

但是一直无法启动,查看原因是pod的存在时间很短,如果让pod持续运行,需要新增一条指令让他一直运行
参考https://serverfault.com/questions/924243/back-off-restarting-failed-container-error-syncing-pod-in-minikube

  • 报错信息如下:
Events:
  Type     Reason   Age                      From            Message
  ----     ------   ----                     ----            -------
  Warning  Failed   55m (x493 over 4h1m)     kubelet, kub02  Error: ImagePullBackOff
  Normal   Pulling  50m (x58 over 4h45m)     kubelet, kub02  Pulling image "ubuntu"
  Warning  BackOff  5m18s (x608 over 4h45m)  kubelet, kub02  Back-off restarting failed container

修改后:

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

apply后可以正常


my-vm01                      1/1     Running   0          16m     10.244.0.11   kub01   <none>           <none>

标签: Ubuntu, ubuntu, kubelet, kubernetes, pod, name, vm01, over, CrashLoopBackOff

相关文章推荐

添加新评论,含*的栏目为必填