容器不以状态CrashLoopBackOff开头

时间:2018-10-17 08:48:11

标签: kubernetes containers

我正在尝试在kubernetes集群中运行一个简单的ubuntu容器。它继续以CrashLoopBackOff状态失败。我什至看不到任何日志来查找原因。

我的Yaml文件如下所示:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ubuntu
  labels:
     app: jubuntu
spec:
    selector:
      matchLabels:
        app: jubuntu
    template:
      metadata:
         labels:
            app: jubuntu
      spec:
         containers:
            - name: ubuntu
              image: ubuntu

1 个答案:

答案 0 :(得分:0)

那是因为您使用的<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/js/foundation.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation.min.css" rel="stylesheet"/> <!-- This demo uses flex grid but you can use float grid too --> <div class="main"> <div class="row"> <div class="columns"> <h2>Accordion</h2> <p>Accordions lets you organize and navigate multiple documents in a single container. Highly useful for switching between items in the container specially when you have a large amount of content.</p> </div> </div> <div class="row"> <div class="columns"> <ul class="accordion" data-accordion data-allow-all-closed="true"> <li class="accordion-item with-button" data-accordion-item> <a href="#" class="accordion-title my-brother-is-a-button">Accordion 1</a> <a href="https://google.com" class="tiny button within-title">button that should lead to a target link</a> <div class="accordion-content" data-tab-content > <p>Panel 1. Lorem ipsum dolor</p> <a href="#">Nowhere to Go</a> </div> </li> <li class="accordion-item" data-accordion-item> <a href="#" class="accordion-title">Accordion 2</a> <div class="accordion-content" data-tab-content> <textarea></textarea> <button class="button">I do nothing!</button> </div> </li> <li class="accordion-item" data-accordion-item> <a href="#" class="accordion-title">Accordion 3</a> <div class="accordion-content" data-tab-content> Type your name! <input type="text"></input> </div> </li> </ul> </div> </div> </div>假设您有一项长期运行的任务。在您的情况下,它将启动容器并立即退出,因为在此无需执行任何操作。换句话说,这种部署没有任何意义。您可以在Deployment字段中添加以下内容以查看其运行情况(仍然无用,但至少看不到它崩溃了):

containers:

另请参阅this troubleshooting guide

为方便起见,如果不想通过编辑YAML清单来执行此操作,也可以使用以下命令:

command:
- sh
- '-c'
- "while true; do echo working ; sleep 5; done;"

如果您非常好奇并想检查是否相同,则可以将以下内容附加到运行命令:$ kubectl run --image=ubuntu -- sh while true; do echo working ; sleep 5; done; (在--dry-run --output=yaml之后,在--image之前)