为什么一个带有简单hello world图像的kubernetes吊舱会收到一条突然的回退信息

为什么一个带有简单hello world图像的kubernetes吊舱会收到一条突然的回退信息,kubernetes,Kubernetes,pod.yml apiVersion: v1 kind: Pod metadata: name: hello-pod labels: zone: prod version: v1 spec: containers: - name: hello-ctr image: hello-world:latest ports: - containerPort: 8080 kubectl get pods N

pod.yml

apiVersion: v1
kind: Pod
metadata:
    name: hello-pod
    labels:
        zone: prod
        version: v1
spec:
    containers:
    - name: hello-ctr
      image: hello-world:latest
      ports:
      - containerPort: 8080
kubectl get pods
NAME        READY     STATUS             RESTARTS   AGE
hello-pod   0/1       CrashLoopBackOff   5          5m
kubectl创建-f pod.yml

apiVersion: v1
kind: Pod
metadata:
    name: hello-pod
    labels:
        zone: prod
        version: v1
spec:
    containers:
    - name: hello-ctr
      image: hello-world:latest
      ports:
      - containerPort: 8080
kubectl get pods
NAME        READY     STATUS             RESTARTS   AGE
hello-pod   0/1       CrashLoopBackOff   5          5m

为什么
CrashLoopBackOff

在这种情况下,预期的行为是正确的。hello world容器用于打印一些消息,然后在完成后退出。因此,这就是为什么您会遇到
CrashLoopBackOff
-

Kubernetes运行一个pod——里面的容器运行预期的命令,然后退出

突然,下面什么也没有了——所以pod再次运行->同样的事情发生了,
重新启动的次数增加了


您可以在
kubectl descripe pod
中看到
终止的
状态,其原因是状态
已完成
。如果您选择的容器映像在完成后不退出,pod将处于运行状态

在这种情况下,预期的行为是正确的。hello world容器用于打印一些消息,然后在完成后退出。因此,这就是为什么您会遇到
CrashLoopBackOff
-

Kubernetes运行一个pod——里面的容器运行预期的命令,然后退出

突然,下面什么也没有了——所以pod再次运行->同样的事情发生了,
重新启动的次数增加了


您可以在
kubectl descripe pod
中看到
终止的
状态,其原因是状态
已完成
。如果您选择的容器映像在完成后不退出,pod将处于运行状态

hello world
实际上正在退出,这意味着Kubernetes认为它崩溃了,并继续重新启动和退出,进入
崩溃后退
。当您运行
docker
您的
hello world
容器时,您会得到以下信息:

$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
$ 

所以,这是一次性的,不是服务。Kubernetes拥有或用于这些类型的工作负载。

hello world
实际上正在退出,这意味着Kubernetes认为它崩溃了,并继续重新启动、退出和进入
崩溃后退
。当您运行
docker
您的
hello world
容器时,您会得到以下信息:

$ sudo docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
$ 

所以,这是一次性的,不是服务。Kubernetes拥有或负责这些类型的工作负载。

可能是很多原因。例如,由于网络流量关闭,节点可能无法拉动它。使用
kubectl get events
检查事件以获取更多信息information@Snowcrash如果我的答案解决了你的问题,请考虑接受它。这可能是一个很大的原因。例如,由于网络流量关闭,节点可能无法拉动它。使用
kubectl get events
检查事件以获取更多信息information@Snowcrash如果我的回答解决了你的问题,请考虑接受。